From 1a264b2f77316d9286bc8015f4b697b9e1557733 Mon Sep 17 00:00:00 2001 From: Rocky Zhang Date: Thu, 2 Dec 2021 14:52:39 -0800 Subject: [PATCH] go get is deprecated, instead use go install (#717) * go get is deprecated, instead use go install * update the build instructions for different go version * build: fix typo and adjust it for windows cmd and powershell --- README.md | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2cb58bdd..8c643939 100644 --- a/README.md +++ b/README.md @@ -41,19 +41,39 @@ See [releases](https://github.com/gokcehan/lf/releases) for pre-built binaries. If you like to build from the source on unix: - env CGO_ENABLED=0 GO111MODULE=on go get -u -ldflags="-s -w" github.com/gokcehan/lf +```bash +# For go version < 1.17 +env CGO_ENABLED=0 GO111MODULE=on go get -u -ldflags="-s -w" github.com/gokcehan/lf + +# For go version >= 1.17 +env CGO_ENABLED=0 go install -ldflags="-s -w" github.com/gokcehan/lf@latest +``` On windows `cmd`: - set CGO_ENABLED=0 - set GO111MODULE=on - go get -u -ldflags="-s -w" github.com/gokcehan/lf +```cmd +REM For go version < 1.17 +set CGO_ENABLED=0 +set GO111MODULE=on +go get -u -ldflags="-s -w" github.com/gokcehan/lf + +REM For go version >= 1.17 +set CGO_ENABLED=0 +go install -ldflags="-s -w" github.com/gokcehan/lf@latest +``` On windows `powershell`: - $env:CGO_ENABLED = '0' - $env:GO111MODULE = 'on' - go get -u -ldflags="-s -w" github.com/gokcehan/lf +```powershell +# For go version < 1.17 +$env:CGO_ENABLED = '0' +$env:GO111MODULE = 'on' +go get -u -ldflags="-s -w" github.com/gokcehan/lf + +# For go version >= 1.17 +$env:CGO_ENABLED = '0' +go install -ldflags="-s -w" github.com/gokcehan/lf@latest +``` ## Usage