博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Gos: Armed Golang (solutions for go module, goproxy, cross compilation, etc.)
阅读量:6070 次
发布时间:2019-06-20

本文共 3988 字,大约阅读时间需要 13 分钟。

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:

  • -
    -
    -
    -

? Brief introduction

from now on, use gos instead of go:

go get => gos getgo build => gos buildgo run => gos rungo ... => 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 GOPROXY to 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 -h on 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 , unzip, rename the binaries to gos and put it in your $PATH. Then use gos as if you were using the go command.
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 is in your $PATH. If you need to use the gos proto command, you need the too.

What GOS can do:

1. Fully compatible with Go native commands

You can use gos just like you would with the go command. 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 cross command 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 architecturegos cross main.go linux amd64gos cross main.go linux armgos cross main.go linux 386gos cross main.go windows amd64gos cross main.go darwin 386# Compiling binary files for all architectures on the specified platformgos cross main.go linux allgos cross main.go windows all# Compiling binary files for all platforms on the specified architecturegos cross main.go all amd64# Trying to compile binary files for all platforms and architecturesgos 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 filegos 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 subdirectoriesgos proto all/all复制代码

Of course, the precondition is that you have a 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 ?

转载地址:http://osbgx.baihongyu.com/

你可能感兴趣的文章
astah-professional-7_2_0安装
查看>>
函数是对象-有属性有方法
查看>>
uva 10107 - What is the Median?
查看>>
Linux下基本栈溢出攻击【转】
查看>>
c# 连等算式都在做什么
查看>>
使用c:forEach 控制5个换行
查看>>
java web轻量级开发面试教程摘录,java web面试技巧汇总,如何准备Spring MVC方面的面试...
查看>>
根据调试工具看Vue源码之组件通信(一)
查看>>
Thrift RPC 系列教程(5)—— 接口设计篇:struct & enum设计
查看>>
斯坦福-随机图模型-week1.5
查看>>
灵活的运用Model类
查看>>
hadoop 之分布式安装
查看>>
使用ansible工具部署ceph
查看>>
linux系列博文---->深入理解linux启动运行原理(一)
查看>>
Android反编译(一) 之反编译JAVA源码
查看>>
结合当前公司发展情况,技术团队情况,设计一个适合的技术团队绩效考核机制...
查看>>
python-45: opener 的使用
查看>>
cad图纸转换完成的pdf格式模糊应该如何操作?
查看>>
Struts2与Struts1区别
查看>>
网站内容禁止复制解决办法
查看>>