samuong / alpaca

A local HTTP proxy for command-line tools. Supports PAC scripts and NTLM authentication.
Apache License 2.0
184 stars 31 forks source link

Can not install alpaca v2.0.0 from Go #110

Closed akihiro closed 1 year ago

akihiro commented 1 year ago

According to README.md, install using Go will fail.

$ go get -v -u github.com/samuong/alpaca
go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.
$ go install github.com/samuong/alpaca@v2.0.0
go: github.com/samuong/alpaca@v2.0.0: github.com/samuong/alpaca@v2.0.0: invalid version: module contains a go.mod file, so module path must match major version ("github.com/samuong/alpaca/v2")

but install alpaca v1.3.2 is well.

$ go install github.com/samuong/alpaca@v1.3.2
go: downloading github.com/samuong/alpaca v1.3.2
go: downloading golang.org/x/term v0.0.0-20220526004731-065cf7ba2467
go: downloading github.com/gobwas/glob v0.2.3
go: downloading github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e
go: downloading github.com/robertkrimen/otto v0.0.0-20211024170158-b87d35c0b86f
go: downloading golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
go: downloading golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
go: downloading gopkg.in/sourcemap.v1 v1.0.5
samuong commented 1 year ago

Hi @akihiro thanks for reporting this. I bumped the version to v2.0.0 so that users would get a heads up on a recent breaking change, but I didn't realise this would break go install. In hindsight I probably should've kept it at v1, since the concept of semantic versions on Go modules really seems to be more about updating libraries.

I think the fix here is to change the package path in go.mod to include /v2 and update the installation instructions accordingly.