Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running "genny": exec: "genny": executable file not found in $PATH #70

Open
SmileJayden opened this issue Jan 14, 2021 · 3 comments
Open

Comments

@SmileJayden
Copy link

SmileJayden commented Jan 14, 2021

//go:generate genny -in=$GOFILE -out=gen-$GOFILE gen "KeyType=string,int ValueType=string,int"

go generate ./... command with above comment reproduce
running "genny": exec: "genny": executable file not found in $PATH messege for me.

However, if I do that command with
//go:generate $GOPATH/bin/genny -in=$GOFILE -out=gen-$GOFILE gen "KeyType=string,int ValueType=string,int"
this comment, genny generation works for me well.

I want to use //go:generate genny -in=$GOFILE -out=gen-$GOFILE gen "KeyType=string,int ValueType=string,int" this comment which is document's recommended comment.

How can I use this one with the best?

below is my go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jayden/Library/Caches/go-build"
GOENV="/Users/jayden/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/jayden/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/jayden/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/jayden/Desktop/vitalcare-backend/go/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sn/k8tknb_14qdb9nwxb6qd7cv80000gn/T/go-build483121234=/tmp/go-build -gno-record-gcc-switches -fno-common

Thanks!

@Ma124
Copy link

Ma124 commented Feb 6, 2021

You probably need to write export PATH="$PATH:$(go env GOPATH)/bin" in a shell script that is always executed. Traditionally ~/.profile or ~/.bashrc (or ~/.zprofile, ~/.zshrc if you use zsh).

@ljmatkins
Copy link

If you've added github.com/cheekybits/genny to your go.mod file, you can also try using something like:

//go:generate go run github.com/cheekybits/genny -in=$GOFILE -out=gen-$GOFILE gen "KeyType=string,int ValueType=string,int"

@piterwie
Copy link

try this one:
go install github.com/cheekybits/genny

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants