Gos: Armed Golang 💪 ( solutions for go module, goproxy, cross compilation, etc.)

Overview

Gos: Armed Golang 💪 v1.2

CircleCI Go Report Card Build Status GoDoc Gitter chat

gos

The current gos is still an alpha version, welcome more heroes 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

🍺 News

🌔 Some fixes and WebAssembly support. What's new in v1.2 (2019-8-1)

👹 Please use golang with version >= 1.12. about "go: cannot find main module"

😲 Is there still a dial-tcp-timeout? Starting with v1.1, you can use GOS_UPSTREAM_ADDRESS to specify the upstream proxy address: What's new in v1.1 (2019-5-30)

🌷 Here's something about "GOPROXY supports comma-separated list of URLs": On GOPROXY (2019-5-23)

🦄 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 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 release page, 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 go binary is in your $PATH. If you need to use the gos proto command, you need the protoc binary 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 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

# Compile with standard go build flags
gos cross -tags="prod" -ldflags="-s -w" -a main.go all all

# Compile with error info printed
gos cross -e main.go all all

# Compile with CGO enabled
CGO_ENABLED=1 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.)
go: google.golang.org/[email protected]: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

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 😎

You might also like...
go HTTP client that makes it plain simple to configure TLS, basic auth, retries on specific errors, keep-alive connections, logging, timeouts etc.

goat Goat, is an HTTP client built on top of a standard Go http package, that is extremely easy to configure; no googling required. The idea is simila

Todo-app-grpc - Go/GRPC codebase containing RealWorld examples (CRUD, auth, advanced patterns, etc)

Go/GRPC codebase containing RealWorld examples (CRUD, auth, advanced patterns, e

GOWS is GoLang web-socket module Provides you with ease of handling web socket connections with a few lines

GOWS GOWS is GoLang web-socket module Provides you with ease of handling web socket connections with a few lines, it supports multi-connection on one

HTTP rate limiting module for Caddy 2

This module implements both internal and distributed HTTP rate limiting. Requests can be rejected after a specified rate limit is hit.

IONOS DNS module for caddy

This package contains a DNS provider module for Caddy. It is used to manage DNS records with the IONOS DNS API using libdns-ionos..

go mod tidy, but for multi-module monorepos via mad science

monotidy go mod tidy, but for multi-module monorepos Why? In a multi-module monorepo, when dependabot updates a shared lib's go.mod, this also invalid

Proxy your Go Module`s Import Path from your own domain to a public host (e.g. github.com).

Go Modules Remote Import Path Proxy Proxy your Go Module`s Import Path from your own domain to a public host (e.g. github.com). For example Uber (buil

Caddy log filter module with a log field filter to extract the user from a basic Authorization HTTP-Header

caddy-basic-auth-filter This packages contains a log field filter to extract the user from a basic Authorization HTTP-Header. Installation xcaddy buil

Plugs module to see different types of plug types needed in different countries, and a comparison tool between two countries plug socket types.

plugs Importing the module: go get github.com/matthewboyd/plugs "github.com/matthewboyd/plugs" How to use the module: There are two functions wi

Comments
  • cannot pull gitlab package

    cannot pull gitlab package

    the error shows like:

    DEBUG dmake.build(231) 2019-06-12 18:29:39,620 compile: go: gitlab.com/xxxx/[email protected]: unexpected status (http://127.0.0.1:41719/gitlab.com/xxx/xxx/@v/v0.0.0-yyyyy-yyyyy.info): 500 Internal Server Error
    

    how to build it

    1. in golang v1.12.4
    2. git checkout v1.1.0
    3. GOOS=linux GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build

    how to exec it

    GOOS=linux GOARCH=amd64 CGO_ENABLED=1 GO111MODULE=on ./gos install -race -v

    go env

    in image golang:v1.12.1

    go version

    v1.12.1

    invalid 
    opened by KielChan 6
  • 刚试了下,无法正常处理

    刚试了下,无法正常处理

    win10 GOS_UPSTREAM_ADDRESS=https://goproxy.io

    gos get -u -v github.com/Go-zh/tools

    D:\gowork>gos get -u -v github.com/Go-zh/tools
    debug mode is on
    local proxy run on: [::]:1342
    Fetching http://127.0.0.1:1342/github.com/%21go-zh/tools/@v/list
    upstream address: https://goproxy.io
    try upstream: github.com/Go-zh/tools
    upstream error: github.com/Go-zh/tools not found
    try local github.com/Go-zh/tools <nil>
    Fetching http://127.0.0.1:1342/golang.org/x/tools/@v/list
    Fetching http://127.0.0.1:1342/golang.org/x/net/@v/list
    try upstream: golang.org/x/tools
    Fetching http://127.0.0.1:1342/golang.org/x/crypto/@v/list
    Fetching http://127.0.0.1:1342/golang.org/x/text/@v/list
    Fetching http://127.0.0.1:1342/golang.org/x/sys/@v/list
    try upstream: golang.org/x/net
    try upstream: golang.org/x/crypto
    try upstream: golang.org/x/text
    try upstream: golang.org/x/sys
    upstream error: golang.org/x/sys not found
    upstream error: golang.org/x/crypto not found
    upstream error: golang.org/x/tools not found
    upstream error: golang.org/x/net not found
    try local golang.org/x/crypto go list -m golang.org/x/crypto: module "golang.org/x/crypto" is not a known dependency
    
    go get: upgrading golang.org/x/[email protected]: unexpected status (http://127.0.0.1:1342/golang.org/x/crypto/@v/list): 500 Internal Server Error
    try local golang.org/x/sys go list -m golang.org/x/sys: module "golang.org/x/sys" is not a known dependency
    
    go get: upgrading golang.org/x/[email protected]: unexpected status (http://127.0.0.1:1342/golang.org/x/sys/@v/list): 500 Internal Server Error
    try local golang.org/x/tools go list -m golang.org/x/tools: module "golang.org/x/tools" is not a known dependency
    
    go get: upgrading golang.org/x/[email protected]: unexpected status (http://127.0.0.1:1342/golang.org/x/tools/@v/list): 500 Internal Server Error
    go get: upgrading golang.org/x/[email protected]: unexpected status (http://127.0.0.1:1342/golang.org/x/tools/@v/list): 500 Internal Server Error
    try local golang.org/x/net go list -m golang.org/x/net: module "golang.org/x/net" is not a known dependency
    
    go get: upgrading golang.org/x/[email protected]: unexpected status (http://127.0.0.1:1342/golang.org/x/net/@v/list): 500 Internal Server Error
    go get: upgrading golang.org/x/[email protected]: unexpected status (http://127.0.0.1:1342/golang.org/x/net/@v/list): 500 Internal Server Error
    exit status 1
    
    question 
    opened by Leadrive 3
Releases(v1.2)
Owner
storyicon
🍖hardcore artist, sometimes enjoy reinventing the wheel
storyicon
Goproxy - HTTP/HTTPS Forward and Reverse Proxy

Go HTTP(s) Forward/Reverse Proxy This is intended to provide the proxy for the goproxy frontend. It is currently a work in progress, and is not very s

David Christenson 0 Jan 4, 2022
Cross-poster - A cross-posting tool for golang

How to start cp config.example.json config.json update config in config.json Bui

Sagleft 0 Feb 19, 2022
A repository for the X-Team community to collaborate and learn solutions to most coding challenges to help prepare for their interviews.

Community Coding Challenge Handbook This repository focuses on helping X-Teamers and community members to thrive through coding challenges offering so

X-Team 121 Sep 6, 2022
Provide cloud-edge message synergy solutions for companies and individuals.the cloud-edge message system based on NATS.

Swarm This project is a cloud-edge synergy solution based on NATS. quikly deploy cloud deploy on k8s #pull the project. git clone https://github.com/g

null 1 Jan 11, 2022
An easy-to-use platform for creating microservices without complex infrastructure solutions.

RPCPlatform An easy-to-use platform for creating microservices without complex infrastructure solutions. Only etcd required. Out of the box you get a

Oleg Trifonov 0 Jan 4, 2022
🔎Sniffing and parsing mysql,redis,http,mongodb etc protocol. 抓包截取项目中的数据库请求并解析成相应的语句。

go-sniffer Capture mysql,redis,http,mongodb etc protocol... 抓包截取项目中的数据库请求并解析成相应的语句,如mysql协议会解析为sql语句,便于调试。 不要修改代码,直接嗅探项目中的数据请求。 中文使用说明 Support List: m

Four 1.7k Dec 27, 2022
scrapligo -- is a Go library focused on connecting to devices, specifically network devices (routers/switches/firewalls/etc.) via SSH and NETCONF.

scrapligo -- scrap(e c)li (but in go!) -- is a Go library focused on connecting to devices, specifically network devices (routers/switches/firewalls/etc.) via SSH and NETCONF.

null 163 Jan 4, 2023
Service registration and discovery, support etcd, zookeeper, consul, etc.

discox 支持类型 zookeeper etcd consul 示例 zookeeper server package main import ( "fmt" "github.com/goeasya/discox" "os" ) func main() { cfg := discox

goeasya 5 Aug 31, 2022
Control your legacy Reciva based internet radios (Crane, Grace Digital, Tangent, etc.) via REST api or web browser.

reciva-web-remote Control your legacy Reciva based internet radios (Crane, Grace Digital, Tangent, etc.) via REST api or web browser. Usage This progr

null 6 May 3, 2022