Skip to content

Go R1 Day 3

Day 3 of 100🔗

progress🔗

  • Learned about GOROOT, GOPATH and how to configure
  • Ran into problems with Visual Studio code reporting:
Failed to find the "go" binary in either GOROOT() or PATH(/usr/bin:/bin:/usr/sbin:/sbin. Check PATH, or Install Go and reload the window.
  • After attempting solution with various profile files, I tried setting the setting: "go.goroot": "/usr/local/opt/go/libexec/", in settings.json and this resolved the issue.
  • After it recognized this, I ran the Go: Current GOPATH from the command palette and it found it.
  • Finally, after this it reporting back some feedback showing it was recognizing the latest version I was running.
  • Initialized a new serverless framework project for aws-go-mod template using the following command: serverless create --template aws-go-mod --path ./sqlserver and the initial project layout was created.
  • I'm sure this will need to be improved as I go along, but since macOS failed on the go path setup, this resolved my problems for now.
# GO: Make tools work in console sessions
$ENV:GOPATH = "$ENV:HOME$($ENV:USERPROFILE)/go"

if ($PSVersionTable.OS -match 'Darwin') {
    $ENV:GOROOT = "/usr/local/opt/go/libexec"
    $ENV:PATH += "$ENV:PATH:$(go env GOPATH)/bin"
    $ENV:GOBIN = "$(go env GOPATH)/bin"
}