alexedwards / scs

HTTP Session Management for Go
MIT License
2.13k stars 166 forks source link

go get github.com/alexedwards/scs/v2 fails #59

Closed krsanky closed 5 years ago

krsanky commented 5 years ago

go get github.com/alexedwards/scs/v2 package github.com/alexedwards/scs/v2: cannot find package "github.com/alexedwards/scs/v2" in any of: /usr/local/go/src/github.com/alexedwards/scs/v2 (from $GOROOT) /home/wise/go/src/github.com/alexedwards/scs/v2 (from $GOPATH)

I'm moving a site I have in development to a new machine. I have the site working on another machine, I last set that one up maybe a week ago.

What's the easiest way to use scs and postgresql?

alexedwards commented 5 years ago

Are you using modules for the dependencies in your project, or the traditional GOPATH approach?

krsanky commented 5 years ago

I am using the traditional GOPATH approach. (I am investigating using modules after you asked, in case that's what I should do going fwd)

alexedwards commented 5 years ago

For running it under your GOPATH:

Everything else should work as normal as documented after that.

But yes, I definitely recommend switching to using modules. There's a great introduction here.

alexedwards commented 5 years ago

I'll update the installation instructions in the README to make this clearer.

krsanky commented 5 years ago

Thanks for the help.

krsanky commented 5 years ago

For posterity: My underlying issue was that the scs api had simply changed in between me working on it. I needed to update my code from the Manager.Load interface to using the simpler Session one. Ironically this is something that the go modules approach would mitigate going forward, because you are more deliberate about versions when importing go code. thanks again

alexedwards commented 5 years ago

Thanks for the explanation and sorry for any trouble. It sounds like it was just unfortunate timing! The API should be stable now for a long time, and you're right, modules will address exact this problem in the future anyway.