Make installable with go install.

This commit is contained in:
Catherine
2025-10-22 05:24:55 +00:00
parent 9f435d6e28
commit d1be93919f
23 changed files with 34 additions and 29 deletions
+2 -2
View File
@@ -25,10 +25,10 @@ jobs:
apt-get -y install ca-certificates
- name: Build service
run: |
go build -o bin/git-pages ./src
go build -o bin/git-pages .
- name: Run static analysis
run: |
go vet ./src
go vet .
package:
needs: [check]
+1
View File
@@ -3,3 +3,4 @@
/bin
/data
/config*.toml*
/git-pages
+1 -1
View File
@@ -22,7 +22,7 @@ WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY src/ ./src/
RUN go build -ldflags "-s -w" -o git-pages ./src
RUN go build -ldflags "-s -w" -o git-pages .
# Compose git-pages and Caddy.
FROM docker.io/library/busybox:1.37.0-musl
+1 -5
View File
@@ -27,6 +27,7 @@
include = [
"go.mod"
"go.sum"
"main.go"
(nix-filter.lib.inDirectory "src")
];
@@ -43,11 +44,6 @@
];
vendorHash = "sha256-8maDQA0RHvCzJCkMtCbHtQuT7emVwuiNqoKBm5+TeeQ=";
fixupPhase = ''
# Apparently `go install` doesn't support renaming the binary, so country girls make do.
mv $out/bin/{src,git-pages}
'';
};
in
{
+7
View File
@@ -0,0 +1,7 @@
// Go insists on having this file here for `go install` to work properly.
package main
import gitpages "codeberg.org/git-pages/git-pages/src"
func main() { gitpages.Main() }
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"crypto/sha256"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"context"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"context"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"bytes"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"context"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"bytes"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"archive/tar"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"context"
+2 -2
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"context"
@@ -69,7 +69,7 @@ func serve(listener net.Listener, handler http.Handler) {
}
}
func main() {
func Main() {
printConfigEnvVars := flag.Bool("print-config-env-vars", false,
"print every recognized configuration environment variable and exit")
printConfig := flag.Bool("print-config", false,
+1 -1
View File
@@ -1,6 +1,6 @@
//go:generate protoc --go_out=. --go_opt=paths=source_relative schema.proto
package main
package git_pages
import (
"bytes"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"context"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"bytes"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"fmt"
+4 -3
View File
@@ -4,14 +4,15 @@
// protoc v6.30.2
// source: schema.proto
package main
package git_pages
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"context"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"errors"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package git_pages
import (
"fmt"