Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

go install command has errors #137

Closed
marclundgren opened this issue Aug 26, 2019 · 7 comments
Closed

go install command has errors #137

marclundgren opened this issue Aug 26, 2019 · 7 comments

Comments

@marclundgren
Copy link

marclundgren commented Aug 26, 2019

Hi,

Following the steps on OS X to install the project:

  1. Open a terminal
  2. Run go get -u go.coder.com/sshcode

I see the following errors: after sshcode fails to install

# go.coder.com/sshcode
../go/src/go.coder.com/sshcode/main.go:28:14: cannot use &rootCmd literal (type *rootCmd) as type cli.Command in argument to cli.RunRoot:
	*rootCmd does not implement cli.Command (wrong type for Run method)
		have Run(*flag.FlagSet)
		want Run(*pflag.FlagSet)
../go/src/go.coder.com/sshcode/main.go:31:5: cannot use new(rootCmd) (type *rootCmd) as type interface { RegisterFlags(*pflag.FlagSet); Run(*pflag.FlagSet); Spec() cli.CommandSpec } in assignment:
	*rootCmd does not implement interface { RegisterFlags(*pflag.FlagSet); Run(*pflag.FlagSet); Spec() cli.CommandSpec } (wrong type for RegisterFlags method)
		have RegisterFlags(*flag.FlagSet)
		want RegisterFlags(*pflag.FlagSet)

$ go version

go version go1.12.9 darwin/amd64

$ which sshcode

sshcode not found
@coadler
Copy link
Contributor

coadler commented Aug 26, 2019

This is most likely a versioning problem in your gopath since we just recently updated our cli package.

If you cd into $GOPATH/src/go.coder.com/sshcode and run GO111MODULE=on go install it should work.

@marclundgren
Copy link
Author

marclundgren commented Aug 26, 2019

My $GOPATH was empty ( sorry im new to go)

→ echo $GOPATH

So i put this on my shell profile

## go
## setup Workspaces https://golang.org/doc/code.html#Workspaces
export PATH=$PATH:$(go env GOPATH)/bin
export GOPATH=$(go env GOPATH)

then

cd $GOPATH/src/go.coder.com/sshcode
GO111MODULE=on go install

GO111MODULE=on go install has no output, so I'm assuming it was successful.

Opening a new session and re-running go get -u go.coder.com/sshcode still gives me the same error 😕

Is there anything else I should do to set up a new GO env?

@marclundgren
Copy link
Author

marclundgren commented Aug 26, 2019

If this helps, here are the contents of the sshcode folder: ls $GOPATH/src/go.coder.com/sshcode

LICENSE         go.sum
README.md       main.go
ci              settings.go
demo.gif        sshcode.go
go.mod          sshcode_test.go

...and it's on the master branch with the latest commit

940305f     3 days ago Dean Sheather  Merge pull request #126 from SscSPs/master

@coadler
Copy link
Contributor

coadler commented Aug 26, 2019

If GO111MODULE=on go install exited without output it should have successfully been installed to $GOPATH/bin.

The reason this is necessary is because we use Go modules for our dependency management, which is enabled by explicitly setting GO111MODULE=on. The normal go get -u won't consult modules when looking for dependencies, which is why it's erroring.

I should probably update the documentation to reflect this. Thanks!

@coadler
Copy link
Contributor

coadler commented Aug 26, 2019

#138 should solve this since we were depending on an older version of https://github.com/cdr/cli

@marclundgren
Copy link
Author

marclundgren commented Aug 27, 2019

Voila

~ → go get -u go.coder.com/sshcode
 ~ → which sshcode
/usr/local/bin/sshcode

Thank you for the quick turn-around @coadler

@coadler
Copy link
Contributor

coadler commented Aug 27, 2019

Glad I could help

@coadler coadler closed this as completed Aug 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants