项目文件夹

文件
Asim Aslam 2339155ff2
goreleaser / goreleaser (push) Has been cancelled
Enforce blocking golangci-lint in CI and clear lint backlog (#2996)
* lint: clear the golangci-lint backlog and enforce a blocking lint in CI

Fixes #2988. Brings 'golangci-lint run ./...' to zero issues (was ~373):

- errcheck: explicitly ignore fire-and-forget calls with '_ =' (and a small
  errcheck.exclude-functions list for response writes — json Encoder.Encode,
  http ResponseWriter.Write, fmt.Fprint*); genuine cases handled.
- unused: remove dead code (unexported decls and dead test helpers) and the
  imports they orphaned.
- staticcheck: ST1005 error strings, ST1016 receiver names, S1000/S1017/S1019/
  S1023 simplifications, SA4004/SA4006/SA4010 dead code, SA1021 net.IP.Equal,
  SA6002 (store *[]byte in sync.Pool).
- govet: fix a context leak (lostcancel) in internal/util/mdns and move
  t.Fatal/Fatalf out of goroutines (testinggoroutine) in tests.
- ineffassign, unconvert: mechanical fixes.

CI: the Lint workflow now runs a blocking full-tree 'golangci-lint run' on
pushes and PRs (dropped only-new-issues now that the tree is clean).

Verified: go build, go vet, test compilation, and unit tests for the
behaviourally-touched packages all pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL

* website: emit go-source meta for /vN paths

pkg.go.dev uses go-source to link to the right files and lines. The /vN
go-get response now returns go-source alongside go-import. Does not affect
go install resolution.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-22 19:48:09 +01:00

108 行
4.6 KiB
Nginx Configuration File

# nginx config for go-micro.dev
#
# Serves the docs site (proxied to micro.github.io/go-micro) and the Go vanity
# import meta tags for `go get` / `go install`.
#
# IMPORTANT — the vanity import-prefix must be the MODULE ROOT, i.e.
# go-micro.dev/vN, never a deeper package path. The old catch-all echoed the
# full request path ($host$1), so `go install go-micro.dev/v6/cmd/micro@latest`
# received the prefix "go-micro.dev/v6/cmd/micro". Go then treats the package
# path as the module root, finds no module that declares it, and falls back to
# the latest non-versioned tag (the ancient v1.x), producing:
#
# version constraints conflict: ... module declares its path as
# github.com/micro/go-micro but was required as go-micro.dev/v6/cmd/micro
#
# The dedicated /vN location below truncates the path to its major-version
# segment and emits "go-micro.dev/vN", so any sub-package (e.g. cmd/micro)
# resolves at @latest.
server {
server_name go-micro.dev;
listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/go-micro.dev/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/go-micro.dev/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
root /var/www/go-micro;
# Plugin submodules: go-micro.dev/plugins/<group>/<vN...>
location ~ ^/plugins/(.*)/(v[0-9].*) {
if ($args = "go-get=1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="$host/plugins/$1/$2 git https://github.com/micro/go-micro.git">';
}
}
# Versioned module paths: go-micro.dev/vN and everything under it.
# Emit the module root (go-micro.dev/$1, e.g. go-micro.dev/v6) as the
# import-prefix — NOT the echoed request path — so that
# `go install go-micro.dev/vN/cmd/micro@latest` resolves correctly.
# Also emit go-source so pkg.go.dev links to the right files/lines.
# This must appear before the catch-all so it wins for /vN paths.
location ~ ^/(v[0-9]+)(/.*)?$ {
if ($args = "go-get=1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="$host/$1 git https://github.com/micro/go-micro.git"><meta name="go-source" content="$host/$1 https://github.com/micro/go-micro https://github.com/micro/go-micro/tree/master{/dir} https://github.com/micro/go-micro/blob/master{/dir}/{file}#L{line}">';
}
proxy_pass https://micro.github.io/go-micro$uri;
proxy_set_header Host micro.github.io;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Accept-Encoding "";
proxy_buffering off;
proxy_redirect off;
resolver 127.0.0.53;
}
location = /docs {
return 302 /docs/;
}
location / {
proxy_pass https://micro.github.io/go-micro/;
proxy_set_header Host micro.github.io;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Accept-Encoding "";
proxy_buffering off;
proxy_redirect off;
resolver 127.0.0.53;
}
# Catch-all. For any other go-get request, advertise the current module
# roots (Go picks the meta whose prefix matches the requested path);
# otherwise proxy to the docs site.
location ~ ^(/?.*) {
if ($args = "go-get=1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="$host/v6 git https://github.com/micro/go-micro.git"><meta name="go-import" content="$host/v5 git https://github.com/micro/go-micro.git">';
}
proxy_pass https://micro.github.io/go-micro/$1;
proxy_set_header Host micro.github.io;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Accept-Encoding "";
proxy_buffering off;
proxy_redirect off;
resolver 127.0.0.53;
}
}
server {
if ($host = go-micro.dev) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name go-micro.dev;
return 404; # managed by Certbot
}