Gos:GOMODULE和GOPROXY解决方案
Gos: Armed Golang
The current gos is still an alpha version, welcome more people to comment and improve it , you can add more commands to it, or modify something to make it perform better.
You can download the compiled binary program here: Release Page
- Brief introduction
- How to start
- What GOS can do: 1. Fully compatible with Go native commands
- 2. Simpler Cross-Compilation
- 3. Rapid generation of .proto
- 4. Go proxy solution
Project Address: https://github.com/storyicon/gos
Brief introduction
from now on, use gos instead of go:
go get => gos get go build => gos build go run => gos run go ... => gos ...
gos is compatible with all go commands and has go mod/get equipped with smart
GOPROXY,
it automatically distinguishes between private and public repositories
and uses
GOPROXYto download your lost package when appropriate.
gos has a few extra commands to enhance your development experience:
cross agile and fast cross compiling proto quick and easy compilation of proto files
You can use
-hon these sub commands to get more information.
How to start
This can't be simpler.
According to your system type, download the zip file from the release page, unzip, rename the binaries to
gosand put it in your
$PATH. Then use
gosas if you were using the
gocommand.
You can also download the source code and compile it using
go build -o gos main.go
Note: The prerequisite for gos to work properly is that the go binary is in your $PATH. If you need to use the
gos protocommand, you need the protoc binary too.
What GOS can do:
1. Fully compatible with Go native commands
You can use
gosjust like you would with the
gocommand. Compatible with all flags and arguments, such as the following:
go get -u -v github.com/xxxx/xxxx => gos get -u -v github.com/xxxx/xxxx
2. Simpler Cross-Compilation
You can use
gos crosscommand for simpler cross-compilation:
# Compile Linux platform binaries for the current system architecture # For example, if your computer are amd64, it will compile main.go into the binary of linux/amd64 architecture. gos cross main.go linux # Specify the build platform and architecture gos cross main.go linux amd64 gos cross main.go linux arm gos cross main.go linux 386 gos cross main.go windows amd64 gos cross main.go darwin 386 # Compiling binary files for all architectures on the specified platform gos cross main.go linux all gos cross main.go windows all # Compiling binary files for all platforms on the specified architecture gos cross main.go all amd64 # Trying to compile binary files for all platforms and architectures gos cross all all
Gos uses parallel compilation, very fast , but still depends on the configuration of your operating system.
more information:
gos cross -h
3. Rapid generation of .proto
This feature may only be useful to RPC developers. You can compile proto files more easily, as follows:
# Compile a single file gos proto helloworld.proto # Compile all proto files under the current folder (excluding subfolders) gos proto all # Compile all proto files in the current directory and all subdirectories gos proto all/all
Of course, the precondition is that you have a protoc binary in your $PATH.
more information:
gos proto -h
4. Go proxy solution
There is a dilemma here. If you don't use
GOPROXY, there may be a large number of Package pull timeouts (network reasons) or non-existence (repository rename, delete or migrate), like the following:
unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
If use
GOPROXY, you will not be able to pull the private repositories (github, gitlab, etc) properly, like that:
go get github.com/your_private_repo: unexpected status (https://athens.azurefd.net/github.com/your_private_repo/@v/list): 500 Internal Server Error
GOS strengthens all of GO's native commands, no matter it's go mod/get/build/run/....Any situation that might cause a package pull, gos will intelligently determine whether the current repository to be pulled needs to use
GOPROXY.
Now, live your thug life
- ImportError: No module named setuptools 解决方案
- windos下no module named setuptools解决方案
- goproxy.io for Go modules
- Android Studio更改工程名异常解决方案 :can't rename root module
- ImportError: No module named yaml解决方案
- npm Cannot find module 'semver' --解决方案
- ImportError: No module named caffe 的解决方案
- Eclipse Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer 解决方案
- pycharm解决方案ModuleNotFoundError: No module named 'sklearn.datasets'
- macOS 下 npm 全局安装仍然提示 Cannot find module 'xxx' 的解决方案
- module 'xgboost' has no attribute 'DMatrix'问题的解决方案
- 关于webconsole报../website/console.go:35: undefined: ssh.InsecureIgnoreHostkey 错误解决方案
- from ggplot import * 报错 AttributeError: module 'pandas' has no attribute 'tslib'解决方案
- Cannot change version of project facet Dynamic web module to 3.0 解决方案
- python 运行python manege.py runserver时报错:“no module named djangorestframework” 的解决方案
- python嵌入错误‘No module named site’的解决方案
- Android BuildConfig.Debug 在module一直为false解决方案
- android 导入module,报failed to find build tools 错解决方案
- importError:No module named setuptools解决方案
- 使用pip报No module named packaging.version的解决方案