gomods / gomods/athens

Upstream configuration does not take effect

Open
#1,689 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
4.8k
Forks
544
Avg merge
7d 21h
Merged PRs (30d)
2

Description

**Is your feature request related to a problem? Please describe.**
I want the private package to be pulled directly from the private code repository. Pull from the upstream server when the third-party package does not exist locally. I don’t know if my configuration is wrong, but it doesn’t take effect.

**Additional context**
version: v0.6.1

ENV:
```shell
GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
```

configuration:
```yaml
GoBinary = "go"
GoEnv = "development"
GoGetWorkers = 40
ProtocolWorkers = 30
LogLevel = "debug"
CloudRuntime = "none"
EnablePprof = false
PprofPort = ":3001"
FilterFile = "/config/filter-file.conf"
Timeout = 300
Port = ":3000"
GlobalEndpoint = "https://mirrors.aliyun.com/goproxy/"
ValidatorHook = ""
PathPrefix = ""
NETRCPath = ""
GithubToken = ""
HGRCPath = ""
TraceExporter = ""
TraceExporterURL = "http://localhost:14268"
StatsExporter = "prometheus"
SumDBs = ["https://sum.golang.org"]
NoSumPatterns = ["code.test.com/*","gitlab.pri.test.com/*"]
DownloadMode = "file:/config/download-hcl.conf"
SingleFlightType = "memory"
StorageType = "minio"
[SingleFlight]
[SingleFlight.Etcd]
Endpoints = "localhost:2379,localhost:22379,localhost:32379"
[SingleFlight.Redis]
Endpoint = "127.0.0.1:6379"
[Storage]
[Storage.Disk]
RootPath = "/path/on/disk"
[Storage.Minio]
Endpoint = "oss"
Key = "key"
Secret = "secret"
EnableSSL = true
Bucket = "athens"
Region = ""
```

download-hcl.conf:

```yaml
downloadURL = "https://mirrors.aliyun.com/goproxy/"
mode = "sync"
download "code.test.com/server/*" {
mode = "sync"
downloadURL = "https://code.test.com"
}

download "gitlab.pri.test.com/*" {
mode = "sync"
downloadURL = "https://gitlab.pri.test.com"

}
```

logs:
```shell
time="2020-12-24T02:29:21Z" level=info msg="exit status 1: go list -m: module github.com/afex/hystrix-go/hystrix: Get https://proxy.golang.org/github.com/afex/hystrix-go/hystrix/@v/list: Forwarding failure\n" http-method=GET http-path=/github.com/afex/hystrix-go/hystrix/@v/list http-url=/github.com/afex/hystrix-go/hystrix/@v/list kind="Not Found" module= operation=download.ListHandler ops="[download.ListHandler pool.List protocol.List vcsLister.List]" version=
time="2020-12-24T02:29:21Z" level=info msg="exit status 1: go list -m: module github.com/afex/hystrix-go: Get https://proxy.golang.org/github.com/afex/hystrix-go/@v/list: Forwarding failure\n" http-method=GET http-path=/github.com/afex/hystrix-go/@v/list http-url=/github.com/afex/hystrix-go/@v/list kind="Not Found" module= operation=download.ListHandler ops="[download.ListHandler pool.List protocol.List vcsLister.List]" version=
time="2020-12-24T02:29:21Z" level=info msg="exit status 1: go list -m: module github.com/afex: Get https://proxy.golang.org/github.com/afex/@v/list: Forwarding failure\n" http-method=GET http-path=/github.com/afex/@v/list http-url=/github.com/afex/@v/list kind="Not Found" module= operation=download.ListHandler ops="[download.ListHandler pool.List protocol.List vcsLister.List]" version=
time="2020-12-24T02:29:21Z" level=info msg="exit status 1: go list -m: module github.com: Get https://proxy.golang.org/github.com/@v/list: Forwarding failure\n" http-method=GET http-path=/github.com/@v/list http-url=/github.com/@v/list kind="Not Found" module= operation=download.ListHandler ops="[download.ListHandler pool.List protocol.List vcsLister.List]" version=
```
Why does the log show that the package is pulled from https://proxy.golang.org instead of https://mirrors.aliyun.com/goproxy/ ?I don’t know why it fails to pull this package.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how GlobalEndpoint, GOPROXY, and download-hcl.conf are loaded and used for module lookup, then compare that path with the logged request to proxy.golang.org. Reproduce the configuration from the issue with version v0.6.1 or the current code. Done means the configured mirror is used and the documented upstream fallback behavior is verified or clearly reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.