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

release v0.1.0 #13

Merged
merged 1 commit into from
Jul 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 62 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,68 @@
[![GVM](https://circleci.com/gh/olimpias/gvm.svg?style=svg)](<https://app.circleci.com/pipelines/github/olimpias/gvm>)


gvm is a short version of `Go Version Manager`. It allows you to manage your installed go version and change its versions
gvm is a short name of `Go Version Manager`. It allows you to manage your go versions and change versions
according to your requirements. It is completely written in Go and provides cross-platform usability

Supports macOS and windows with release binaries. It requires to preinstalled go(for now...) and `GOPATH` to be
set in environmental variables. In addition to that, the user privileges must be set to run the program. Otherwise, there will
be permission issues to change and replace folders.
gvm supports Windows, Linux, Freebsd and MacOS. It requires to preinstalled go for windows and `GOROOT` to be
set in environmental variables for windows. In addition to that, the user privileges must be set to run the program for all OSs. Otherwise, there will
be permission issues while removing and replacing the folders/files. [Check Troubleshooting section](#Troubleshooting).

## Installation

Download release version from [releases](https://github.com/olimpias/gvm/releases) according to your operating system. For now, releases are done for macOS and windows 64 bit.
**Linux**:
```shell script
#Example for amd64 arch
# Linux Example (assumes ~/bin is in PATH).
curl -o gvm.tar.gz -O https://github.com/olimpias/gvm/releases/download/v0.1.0/gvm.linux.amd64.tar.gz
tar -C ~/bin -xzf gvm.tar.gz
chmod +x ~/bin/gvm
gvm use 1.14.4
```

Extract the executable from tar/zip. Then enjoy it!
Supported Archs For Linux : `386`, `amd64`, `arm`, `arm64`, `mips`, `mipsle`, `mips64`, `mips64le`, `ppc64`, `ppc64le`, `s390x`

**MacOS**:
```shell script
# Example for amd64 arch
curl -o gvm.tar.gz -O https://github.com/olimpias/gvm/releases/download/v0.1.0/gvm.darwin.amd64.tar.gz
tar -C /usr/local/bin -xzf gvm.tar.gz
chmod +x /usr/local/bin/gvm
gvm use 1.14.4
```

Supported Archs For MacOs : `amd64`

**Windows**:
```shell script
# Example for amd64 arch
curl -o gvm.zip -O https://github.com/olimpias/gvm/releases/download/v0.1.0/gvm.windows.amd64.exe.zip
unzip gvm.zip
gvm use 1.14.4
```

Supported Archs For MacOs : `386`, `amd64`

**FreeBSD**:
```shell script
#Example for amd64 arch
# Freebsd Example (assumes ~/bin is in PATH).
curl -o gvm.tar.gz -O https://github.com/olimpias/gvm/releases/download/v0.1.0/gvm.freebsd.amd64.tar.gz
tar -C ~/bin -xzf gvm.tar.gz
chmod +x ~/bin/gvm
gvm use 1.14.4
```

Supported Archs For Freebsd : `386`, `amd64`, `arm`, `arm64`


To support use other architecture, you just need to change **amd64** in the link for `curl` command.

**Note:** If you are trying to install go with this file, you have to set bash configuration by yourself. Also, **gvm** requires `GOROOT` environmental variable.
**Note:** If you are trying to install go for the first time, it will not work for Windows OS. It requires preinstalled go for windows.

Checkout example for [setting up environment](#setting-up-env-for-v001-from-scratch-in-macos)
Download release version from [releases](https://github.com/olimpias/gvm/releases) according to your operating system and architecture.

Extract the executable from tar/zip. Then enjoy it!

## Command Usages
gvm provides 5 type of commands that you can apply; `help`, `list`, `use`, `download` and `del`
Expand Down Expand Up @@ -80,36 +126,15 @@ list list the possible downloaded versions that ready to use.
dl downloads the version that you specify to your machine.
use uses the version that specify as an input. It has to be downloaded first using dl command.
del deletes the version that you specify as an input
```

## Setting Up Env For v0.0.1 From Scratch in MacOS

Be sure if go is installed. Otherwise it is hardly recommended to install for alpha version.

Then, check if `goroot` is set with `echo $GOROOT`.

If it returns empty try using `which go`, this will return go path.

Set env with `export GOROOT=PATH`(put result from `which go` command, you should exclude /bin/go in path). For default installation it is most likely `/usr/local/go`. It is recommanded to add it to bash profile
otherwise you need to set `GOROOT` into environmental variable all the time to use **gvm**.
Example result `/usr/local/go/bin/go`, you need to use `/usr/local/go` as `GOROOT`.

Check the permission for users. Most likely for default installation it is assigned to root user and your current user does not have access for that directory to edit.

Go to `cd $GOROOT/..` path and use `sudo chmod -R 777 go` or `sudo chmod -R 755 go`.

Click [link](https://github.com/olimpias/gvm/releases/download/v0.0.1/gvm_0.0.1.darwin-amd64.tar.gz) to download tar file.

Use `tar xvf gvm_0.0.1.darwin-amd64.tar.gz` to extract tar file and it will extract `gvm` executable. It is ready for use
```

You need to use it with `./` at the beginning. Example: `./gvm dl 1.14.4`
## Troubleshooting

For instance, if you want to install go `1.14.4`,
When Go is installed by default installer, the created folder could have access restrictions. If it is the case please use
following command to bypass it.

Use `./gvm use 1.14.4`. Once you run this command, it will replace existing go version with `1.14.4`.
Mostly Go is installed to `/usr/local/go` path by default installer. We need to grant access for `/usr/local/go` file path.

## TODOs
- [X] Add progressbar for unzipping
- [X] Add CI/CD for testing windows and linux over circleci
- [ ] Add executable as a downloadable so that it could be usable through homebrew or other example platforms.
- [ ] Provide initial installation of go(without preinstalled go) with executable file.
```shell script
sudo chmod -R 755 /usr/local/go
```
9 changes: 6 additions & 3 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ mkdir -p "release"
for f in $FILES
do
echo "Processing $f file..."
cp "$f" "gvm"
if [[ $f == *"windows"* ]]
then
zip "$f.zip" "gvm"
cp "$f" gvm.exe
zip "$f.zip" gvm.exe
mv "$f.zip" ./release
rm -rf gvm.exe
else
tar -zcvf "$f.tar.gz" "gvm"
cp "$f" "dist/gvm"
tar -C dist -zcvf "$f.tar.gz" gvm
mv "$f.tar.gz" ./release
rm -rf dist/gvm
fi
rm -rf "$f"
done