Created
November 9, 2015 15:31
-
-
Save j16r/66d7fa01d2b754faad94 to your computer and use it in GitHub Desktop.
`go vet` treats Logf as a special function, even for custom definitions. `go` used to do this, but looks like it was fixed in 1.5.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type Level int | |
const CODE Level = 1 | |
type Logger struct { | |
} | |
func (l *Logger) Logf(code Level, message string, args ...interface{}) { | |
fmt.Printf("Code(%d) %s", code, fmt.Sprintf(message, args)) | |
} | |
func main() { | |
logger := Logger{} | |
logger.Logf(CODE, "Hello %s", "World") | |
} |
Author
j16r
commented
Nov 9, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment