I'm trying to read in user CLI settings in one package and pass them on to another package. I've learned about private and public methods/attributes but can't seem to access them and I keep getting 'undefined' error message when building the app
main.go
package main
import (
"fmt"
"sun/argparser"
)
func main(){
fmt.Println("Running script..")
args := argparser.GetFlags()
fmt.Printf("%+v\n", args)
fmt.Println(args.Wallpaper)
}
argparser.go
package argparser
import (
"log"
"flag"
)
type Args struct {
Wallpaper string
}
func GetFlags() Args {
wallpaper := flag.String("wallpaper", "", "some help msg")
flag.Parse()
args := Args{}
args.Wallpaper = string(*wallpaper)
if args.Wallpaper == "" {
log.Fatal("Need to provide valid wallpaper path")
}
return args
}
And when I try to build it it returns:
./main.go:15:19: args.Wallpaper undefined (type argparser.Args has no field or method Wallpaper)