MCPcopy Index your code
hub / github.com/golang/example / main

Function main

hello/hello.go:44–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42)
43
44func main() {
45 // Configure logging for a command-line program.
46 log.SetFlags(0)
47 log.SetPrefix("hello: ")
48
49 // Parse flags.
50 flag.Usage = usage
51 flag.Parse()
52
53 // Parse and validate arguments.
54 name := "world"
55 args := flag.Args()
56 if len(args) >= 2 {
57 usage()
58 }
59 if len(args) >= 1 {
60 name = args[0]
61 }
62 if name == "" { // hello '' is an error
63 log.Fatalf("invalid name %q", name)
64 }
65
66 // Run actual logic.
67 if *reverseFlag {
68 fmt.Printf("%s, %s!\n", reverse.String(*greeting), reverse.String(name))
69 return
70 }
71 fmt.Printf("%s, %s!\n", *greeting, name)
72}

Callers

nothing calls this directly

Calls 2

StringFunction · 0.92
usageFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…