nexus 3.17.0 新版本對於go 包管理的支持是基於go mod 的,同時咱們也須要一個athens server
而後在nexus 中配置proxy 類型的repogit
athens server
,nexus 對於go mod 的支持就是經過配置proxy到athens server
GOPROXY
環境變量version: "3"
services:
nexus:
image: sonatype/nexus3:3.17.0
ports:
- "80:8081"
volumes:
- "./nexus-data:/nexus-data"
athens:
image: gomods/athens:latest
ports:
- "3000:3000"
127.0.0.1 dalongrong.com
go mod init github.com/rongfengliang/nexus-mod
go: creating new go.mod: module github.com/rongfengliang/nexus-mod
main.go:
package main
import (
"fmt"
"net/http"
"github.com/urfave/negroni"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "Welcome to the home page!")
})
n := negroni.Classic() // Includes some default middlewares
n.UseHandler(mux)
http.ListenAndServe(":8000", n)
}
export GOPROXY=http://dalongrong.com/repository/golang/
go mod tidy
go build
./nexus-mod
效果github
├── go.mod
├── go.sum
├── main.go
└── nexus-mod
以上是一個簡單的學習試用,同時也支持group 類型的,仍是很不錯的golang
https://help.sonatype.com/repomanager3/release-notes/2019-release-notes#id-2019ReleaseNotes-RepositoryManager3.17.0
https://help.sonatype.com/repomanager3/formats/go-repositories
https://github.com/rongfengliang/nexus-golang-packagedocker