exebook
exebook

Reputation: 33900

How to write a wrapper around fmt.Print

func myPrint(a...fmt.Stringer) {
    fmt.Print(a)
}

func main(){
    myPrint(1,"asd")
}

I get "int does not implement String method"

How to write a wrapper around fmt.Print()?

Upvotes: 0

Views: 93

Answers (1)

cshu
cshu

Reputation: 5944

Change myPrint to:

func myPrint(a ...interface{}) {
    fmt.Print(a...)
}

Upvotes: 1

Related Questions