Home > Back-end >  How to properly install GO with paths and all?
How to properly install GO with paths and all?

Time:01-25

I have installed GO, setup the paths but when i run a file i get this error:

error!! exec: "sqlboiler": executable file not found in $PATH
exec: "sqlboiler": executable file not found in $PATH
exec: "sqlboiler": executable file not found in $PATH
exit status 3

What is going wrong?

CodePudding user response:

The installation instructions are good, https://go.dev/doc/install. However, for me un Ubuntu 20.4 in wsl2, the suggested path for the binaries wasn't enough. Only go and gofmt are added to /usr/local/go/bin.

I did add the below to my .bashrc, since go install puts the binaries in this location on my system.

export PATH="$HOME/go/bin:$PATH"

Note, that the path to the binaries may differ on your system, so you have to adjust it accordingly.

Any binary you install with go install that is added to this path will be available to your shell afterwards.

For example:

$ go install github.com/volatiletech/sqlboiler/v4@latest
$ go install github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql@latest

$ whereis sqlboiler
sqlboiler: /home/blue/go/bin/sqlboiler

Potentially, you also need some database packages to your system. I am not sure on this any more. For example, you could add some Postgres libs if you are using Postgres. You have to see if it works without.

apt-get install postgresql-client-common postgresql-client-12

CodePudding user response:

How to properly install GO with paths and all?

  1. Install Go with the installer (Windows) or archive (extract into /usr/local on Linux/Mac).
  2. When installing from archive, manually add the directory path where the go binary is located (/usr/local/go) to PATH.
  3. Set GOPATH to a directory path wherein to contain bin, pkg and src sub-directories.
  4. Add ${GOPATH}/bin to PATH.

What is going wrong?

The program you are running is trying to run the executable sqlboiler, which cannot be found in any of the directories specified in PATH.

  •  Tags:  
  • Related