diff options
| -rw-r--r-- | archlinux/PKGBUILD (renamed from deployments/archlinux/PKGBUILD) | 4 | ||||
| -rw-r--r-- | docker/Dockerfile (renamed from deployments/docker/Dockerfile) | 2 | ||||
| -rw-r--r-- | main.go (renamed from cmd/go-import-redirect/main.go) | 4 | ||||
| -rw-r--r-- | main_aws.go (renamed from cmd/go-import-redirect/main_aws.go) | 4 | ||||
| -rw-r--r-- | resp.go (renamed from internal/lib.go) | 2 | ||||
| -rw-r--r-- | resp_test.go (renamed from internal/lib_test.go) | 2 | ||||
| -rw-r--r-- | systemd/go-import-redirect.service (renamed from deployments/systemd/go-import-redirect.service) | 0 |
7 files changed, 7 insertions, 11 deletions
diff --git a/deployments/archlinux/PKGBUILD b/archlinux/PKGBUILD index 1de09e4..e8a538d 100644 --- a/deployments/archlinux/PKGBUILD +++ b/archlinux/PKGBUILD @@ -17,12 +17,12 @@ sha256sums=(SKIP) build() { cd ${pkgname} - go build ./cmd/${pkgname} + go build } package() { cd ${pkgname} install -Dm755 ${pkgname} ${pkgdir}/usr/bin/${pkgname} - install -Dm644 deployments/systemd/${pkgname}.service ${pkgdir}/usr/lib/systemd/system/${pkgname}.service + install -Dm644 systemd/${pkgname}.service ${pkgdir}/usr/lib/systemd/system/${pkgname}.service install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE } diff --git a/deployments/docker/Dockerfile b/docker/Dockerfile index 5cc27a9..13dd13f 100644 --- a/deployments/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.15 WORKDIR /root COPY . ./ ENV CGO_ENABLED=0 -RUN go build ./cmd/go-import-redirect +RUN go build FROM scratch COPY --from=0 /root/go-import-redirect /go-import-redirect diff --git a/cmd/go-import-redirect/main.go b/main.go index ea994b2..c2b331e 100644 --- a/cmd/go-import-redirect/main.go +++ b/main.go @@ -19,8 +19,6 @@ import ( "time" "golang.org/x/sys/unix" - - "go.awhk.org/go-import-redirect/internal" ) func redirect(resp http.ResponseWriter, req *http.Request) { @@ -38,7 +36,7 @@ func redirect(resp http.ResponseWriter, req *http.Request) { resp.Header().Set("Location", "https://pkg.go.dev/"+pkg) resp.WriteHeader(http.StatusFound) } - if _, err := fmt.Fprint(resp, internal.GetBody(pkg)); err != nil { + if _, err := fmt.Fprint(resp, GetBody(pkg)); err != nil { log.Println("fmt.Fprint:", err) } } diff --git a/cmd/go-import-redirect/main_aws.go b/main_aws.go index 4d4b0e7..c81cfc6 100644 --- a/cmd/go-import-redirect/main_aws.go +++ b/main_aws.go @@ -14,15 +14,13 @@ import ( "github.com/aws/aws-lambda-go/events" "github.com/aws/aws-lambda-go/lambda" - - "go.awhk.org/go-import-redirect/internal" ) func redirect(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { var ( pkg = path.Join(req.Headers["Host"], req.Path) resp = events.APIGatewayProxyResponse{ - Body: internal.GetBody(pkg), + Body: GetBody(pkg), Headers: map[string]string{"Content-Type": "text/html; charset=utf-8"}, } ) diff --git a/internal/lib.go b/resp.go index 742a9c7..3403e17 100644 --- a/internal/lib.go +++ b/resp.go @@ -3,7 +3,7 @@ // Use of this source code is governed by the ISC license that can be // found in the LICENSE file. -package internal +package main import ( "fmt" diff --git a/internal/lib_test.go b/resp_test.go index 19a880d..4dadf74 100644 --- a/internal/lib_test.go +++ b/resp_test.go @@ -3,7 +3,7 @@ // Use of this source code is governed by the ISC license that can be // found in the LICENSE file. -package internal +package main import "testing" diff --git a/deployments/systemd/go-import-redirect.service b/systemd/go-import-redirect.service index 0691753..0691753 100644 --- a/deployments/systemd/go-import-redirect.service +++ b/systemd/go-import-redirect.service |
