I Want Process-Aware Types(sean.barag.org)1 points·by sjbarag·2 anni fa·1 commentssean.barag.orgI Want Process-Aware Typeshttps://sean.barag.org/writing/process-aware-types1 commentsPost comment[–]38·2 anni fareply> By default, you’re one fmt.(Sp|P)rintf("%v\n", session) away from including a user’s password hash in your logs, writing it to a file, or returning it in a server response.nope. just use a custom String method: func (UserSession) String() string { return "hello world" } or a custom type: type UserSession struct { Username string pwHash password } type password string func (password) String() string { return "[redact]" }
nope. just use a custom String method:
or a custom type: