diff options
| author | Max Resnick <max@ofmax.li> | 2025-08-01 22:10:20 -0700 |
|---|---|---|
| committer | Max Resnick <max@ofmax.li> | 2025-09-06 21:47:16 -0700 |
| commit | df0a52f53739a1bc05620f3f21533922488c0491 (patch) | |
| tree | b5c201bbf214a93d8ed934492bd888e8fc8a1388 /CLAUDE.md | |
| parent | 462bfd8fc9707a5eae3233e69f5b8a522972ed74 (diff) | |
| download | go-git-server-1.0.4-latest.df0a52f.11.tar.gz | |
feat: go-module support1.0.4-latest.df0a52f.11
Diffstat (limited to 'CLAUDE.md')
| -rw-r--r-- | CLAUDE.md | 35 |
1 files changed, 32 insertions, 3 deletions
@@ -13,6 +13,7 @@ This is `go-git-server`, an experimental Git HTTP server in Go that provides aut - `internal/git/handler.go` - Git HTTP backend CGI wrapper - `internal/authz/` - Authentication/authorization middleware using Casbin - `internal/admin/` - Administrative services and configuration management + - `internal/modules/` - Go module proxy endpoints and go-import metadata - **Configuration**: Uses Casbin for RBAC with auth model (`auth_model.ini`) and policy files - **Authentication**: Token-based system with bcrypt hashing stored in CSV format - **Authorization**: Role-based access control with roles like admin, maintainers, bots @@ -63,10 +64,10 @@ just clean ### Token Management ```bash # Generate new authentication token -TMPDIR=/tmp/go-build go run cmd/tokentool/main.go -generate -name <username> +TMPDIR=$PWD/testdata go run cmd/tokentool/main.go -generate -name <username> # List existing tokens -TMPDIR=/tmp/go-build go run cmd/tokentool/main.go -list +TMPDIR=$PWD/testdata go run cmd/tokentool/main.go -list # Generate token directly from main binary ./main -g @@ -80,7 +81,8 @@ TMPDIR=/tmp/go-build go run cmd/tokentool/main.go -list - **Linting**: Uses golangci-lint - **Build System**: Uses `just` (justfile) for task automation - **Container**: Designed for Kubernetes deployment with minimal dependencies -- **TMPDIR**: Use `TMPDIR=/tmp/go-build` for `go run` commands if /tmp filesystem doesn't allow executables +- **TMPDIR**: **CRITICAL** - /tmp filesystem doesn't allow executables. Always use `TMPDIR=$PWD/testdata` for `go run` commands +- **Go Module Support**: Implements basic Go module proxy protocol for `go get` compatibility ## Large File Support @@ -96,6 +98,33 @@ git config http.postBuffer 524288000 This setting allows git to handle large file pushes over HTTP without timing out. +## Go Module Support + +The server implements basic Go module proxy functionality to enable `go get` operations: + +### Usage +```bash +# Enable go module proxy (make repositories discoverable) +go get yourdomain.com/repo + +# The server automatically serves: +# - go-import meta tags for module discovery +# - Module proxy endpoints (@v/list, @latest, .info, .mod, .zip) +# - Version metadata from git tags +``` + +### Features +- **Module Discovery**: Serves go-import HTML meta tags +- **Version Listing**: Lists available versions from git tags +- **Pseudo-versions**: Generates pseudo-versions for untagged commits +- **Module Archives**: Creates zip files from git repository content +- **go.mod Serving**: Extracts go.mod files from specific versions + +### Limitations +- Basic implementation focused on compatibility, not full Athens-style features +- No caching, authentication bypass, or advanced proxy features +- Requires properly tagged semantic versions (v1.0.0, v1.2.3, etc.) + ## Configuration Files - `gitserver.yaml` - Server configuration and repository definitions |