kevincobain2000 / gobrew

Go version manager, written in Go. Super simple tool to install and manage Go versions. Install go without root. Gobrew doesn't require shell rehash.
https://medium.com/web-developer/go-version-manager-gobrew-c8750157dfe6
MIT License
364 stars 24 forks source link

404 error on Mac air laptop #135

Closed gedw99 closed 11 months ago

gedw99 commented 11 months ago
curl -sLk https://raw.githubusercontent.com/kevincobain2000/gobrew/master/git.io.sh | sh
Installing gobrew from: https://github.com/kevincobain2000/gobrew/releases/latest/download/gobrew-darwin-arm64 ...

Installed successfully to: /Users/apple/.gobrew/bin/gobrew
============================

gobrew 1.9.1

Usage:

    gobrew use <version>           Install and set <version>
    gobrew ls                      Alias for list
    gobrew ls-remote               List remote versions (including rc|beta versions)

    gobrew install <version>       Only install <version> (binary from official or GOBREW_REGISTRY env)
    gobrew uninstall <version>     Uninstall <version>
    gobrew list                    List installed versions
    gobrew self-update             Self update this tool
    gobrew prune                   Uninstall all go versions except current version
    gobrew version                 Show gobrew version
    gobrew help                    Show this message

Examples:
    gobrew use 1.16                # use go version 1.16
    gobrew use 1.16.1              # use go version 1.16.1
    gobrew use 1.16rc1             # use go version 1.16rc1

    gobrew use 1.16@latest         # use go version latest of 1.16

    gobrew use 1.16@dev-latest     # use go version latest of 1.16, including rc and beta
                                   # Note: rc and beta become no longer latest upon major release

    gobrew use mod                 # use go version listed in the go.mod file
    gobrew use latest              # use go version latest available
    gobrew use dev-latest          # use go version latest avalable, including rc and beta

Installation Path:

    # Add gobrew to your ~/.bashrc or ~/.zshrc
    export PATH="$HOME/.gobrew/current/bin:$HOME/.gobrew/bin:$PATH"
    export GOROOT="$HOME/.gobrew/current/go"

============================
apple@apples-MacBook-Pro ~ % gobrew use latest
==> [Info] Fetching remote versions

==> [Error] Cannot read response: 404 Not Foundpanic: runtime error: index out of range [-1]

goroutine 1 [running]:
github.com/kevincobain2000/gobrew.(*GoBrew).judgeVersion(0x14000166940?, {0x16f3774bb, 0x6})
    /home/runner/work/gobrew/gobrew/gobrew.go:437 +0x760
github.com/kevincobain2000/gobrew.(*GoBrew).Install(0x14000177e88, {0x16f3774bb?, 0x14000046768?})
    /home/runner/work/gobrew/gobrew/gobrew.go:367 +0x8c
main.main()
    /home/runner/work/gobrew/gobrew/cmd/gobrew/main.go:79 +0xfc
apple@apples-MacBook-Pro ~ % which gobrew
/Users/apple/.gobrew/bin/gobrew
apple@apples-MacBook-Pro ~ % gobrew ls                                                                               
==> [Info] Nothing installed yet. Run `gobrew use latest` to install a latest version of Go.
apple@apples-MacBook-Pro ~ % gobrew ls-remote 
==> [Info] Fetching remote versions

==> [Error] Cannot read response: 404 Not Found%    
gedw99 commented 11 months ago

it looks like the manifest where it gets endpoints from is messed up...

gobrew use 1.16
==> [Info] Downloading version: 1.16
==> [Info] Downloading from: https://go.dev/dl/go1.16.darwin-arm64.tar.gz
==> [Info] Downloading to: /Users/apple/.gobrew/downloads
Downloading 100% |██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| (120/120 MB, 6.8 MB/s)         
==> [Info] Extracting from: /Users/apple/.gobrew/downloads/go1.16.darwin-arm64.tar.gz
==> [Info] Extracting to: /Users/apple/.gobrew/versions/1.16
[Success] Extract to /Users/apple/.gobrew/versions/1.16
==> [Success] Downloaded version: 1.16
==> [Info] Changing go version to: 1.16 
==> [Success] Changed go version to: 1.16
apple@apples-MacBook-Pro ~ % gobrew ls-remote            
==> [Info] Fetching remote versions

==> [Error] Cannot read response: 404 Not Found%                                                                                                                                              apple@apples-MacBook-Pro ~ % gobrew ls-remote
==> [Info] Fetching remote versions

==> [Error] Cannot read response: 404 Not Found%                                                                                                                                              apple@apples-MacBook-Pro ~ % gobrew ls       
1.16*

current: 1.16
gedw99 commented 11 months ago

for now I just went with "brew install go" so I can work.

kevincobain2000 commented 11 months ago

I think I know what’s happening. Will investigate tomorrow morning. Thanks for reporting.

kevincobain2000 commented 11 months ago

Everything is fine, I can't reproduce the error. Probably you have an older version of gobrew installed.

╰─$ gobrew version
[INFO] gobrew version is 1.9.1
gedw99 commented 11 months ago

Mhh weird

I used the curl command from the Readme on a new laptop