Skip to content

Instantly share code, notes, and snippets.

@oscarzhou
Created June 12, 2021 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscarzhou/1eab1f20806f2a0988c566467041f16e to your computer and use it in GitHub Desktop.
Save oscarzhou/1eab1f20806f2a0988c566467041f16e to your computer and use it in GitHub Desktop.
package main
import (
"flag"
"fmt"
)
type Profile struct {
Name string
Age uint
Verified bool
}
func main() {
var version string
var profile Profile // new added
flag.StringVar(&version, "setVersion", "1.0.0", "")
flag.Var(&profile, "setProfile", "") // new added
flag.Parse()
fmt.Println("version = ", version)
fmt.Println("profile = ", profile) // new added
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment