Skip to content

Commit

Permalink
change to vanity package
Browse files Browse the repository at this point in the history
  • Loading branch information
bbengfort committed Jan 2, 2025
1 parent 2171d78 commit 8d0660d
Show file tree
Hide file tree
Showing 22 changed files with 37 additions and 37 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
GOTEST_GITHUB_ACTIONS: 1
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/rotationalio/vanity
working-directory: ${{ env.GOPATH }}/src/go.rtnl.ai/vanity
steps:
- name: Set up Go
uses: actions/setup-go@v5
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: ${{ env.GOPATH }}/src/github.com/rotationalio/vanity
path: ${{ env.GOPATH }}/src/go.rtnl.ai/vanity

- name: Code Generation
run: go generate ./...
Expand All @@ -74,7 +74,7 @@ jobs:
GOBIN: ${{ github.workspace }}/go/bin
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/github.com/rotationalio/vanity
working-directory: ${{ env.GOPATH }}/src/go.rtnl.ai/vanity
steps:
- name: Set up Go
uses: actions/setup-go@v5
Expand All @@ -92,7 +92,7 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: ${{ env.GOPATH }}/src/github.com/rotationalio/vanity
path: ${{ env.GOPATH }}/src/go.rtnl.ai/vanity

- name: Code Generation
run: go generate ./...
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ builds:
binary: vanityd
flags:
- -v
ldflags: -s -w -X github.com/rotationalio/vanity.GitVersion={{.Commit}} -X github.com/rotationalio/vanity.BuildDate={{.Date}}
ldflags: -s -w -X go.rtnl.ai/vanity.GitVersion={{.Commit}} -X go.rtnl.ai/vanity.BuildDate={{.Date}}
env:
- CGO_ENABLED=0
goos:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ARG TARGETARCH
RUN update-ca-certificates

# Use modules for dependencies
WORKDIR $GOPATH/src/github.com/rotationalio/vanity
WORKDIR $GOPATH/src/go.rtnl.ai/vanity

COPY go.mod .
COPY go.sum .
Expand All @@ -31,7 +31,7 @@ COPY . .

# Build binary
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
-ldflags="-X 'github.com/rotationalio/vanity.GitVersion=${GIT_REVISION}'" \
-ldflags="-X 'go.rtnl.ai/vanity.GitVersion=${GIT_REVISION}'" \
-o /go/bin/vanityd \
./cmd/vanityd

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Golang Vanity URLs for Import Paths

This package implements a server that can respond to the golang import paths protocol and redirect `go tool` to the correct repository path so that we can host our go packages at `go.rotational.io` instead of `github.com/rotationalio`.
This package implements a server that can respond to the golang import paths protocol and redirect `go tool` to the correct repository path so that we can host our go packages at `go.rtnl.ai` instead of `github.com/rotationalio`.

This server implements some Rotational specific tools. If you're interested in hosting your own vanity URLs for Go packages, I suggest reading [Making a Golang Vanity URL](https://medium.com/@JonNRb/making-a-golang-vanity-url-f56d8eec5f6c) by Jon Betti and using his [go.jonrb.io/vanity](https://pkg.go.dev/go.jonnrb.io/vanity) server as a starting place.
6 changes: 3 additions & 3 deletions cmd/vanityd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"os"
"text/tabwriter"

pkg "github.com/rotationalio/vanity"
"github.com/rotationalio/vanity/config"
"github.com/rotationalio/vanity/server"
pkg "go.rtnl.ai/vanity"
"go.rtnl.ai/vanity/config"
"go.rtnl.ai/vanity/server"

"github.com/joho/godotenv"
confire "github.com/rotationalio/confire/usage"
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"time"

"github.com/rotationalio/confire"
"github.com/rotationalio/vanity/logger"
"github.com/rs/zerolog"
"go.rtnl.ai/vanity/logger"
)

// All environment variables will have this prefix unless otherwise defined in struct
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"os"
"testing"

"github.com/rotationalio/vanity/config"
"github.com/rs/zerolog"
"github.com/stretchr/testify/require"
"go.rtnl.ai/vanity/config"
)

var testEnv = map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/rotationalio/vanity
module go.rtnl.ai/vanity

go 1.23.3

Expand Down
2 changes: 1 addition & 1 deletion logger/level_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/rotationalio/vanity/logger"
"go.rtnl.ai/vanity/logger"

"github.com/rs/zerolog"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/rotationalio/vanity/logger"
"go.rtnl.ai/vanity/logger"

"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
Expand Down
2 changes: 1 addition & 1 deletion logger/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"time"

"github.com/julienschmidt/httprouter"
"github.com/rotationalio/vanity/server/middleware"
"github.com/rs/zerolog/log"
"go.rtnl.ai/vanity/server/middleware"
)

func HTTPLogger(server, version string) middleware.Middleware {
Expand Down
6 changes: 3 additions & 3 deletions server/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"time"

"github.com/julienschmidt/httprouter"
"github.com/rotationalio/vanity"
"github.com/rotationalio/vanity/server/middleware"
"github.com/rotationalio/vanity/server/render"
"go.rtnl.ai/vanity"
"go.rtnl.ai/vanity/server/middleware"
"go.rtnl.ai/vanity/server/render"
)

// If the server is in maintenance mode, aborts the current request and renders the
Expand Down
2 changes: 1 addition & 1 deletion server/middleware/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"testing"

"github.com/julienschmidt/httprouter"
. "github.com/rotationalio/vanity/server/middleware"
"github.com/stretchr/testify/require"
. "go.rtnl.ai/vanity/server/middleware"
)

func MakeTestMiddleware(name string, abort bool, calls *Calls) Middleware {
Expand Down
2 changes: 1 addition & 1 deletion server/render/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"net/http/httptest"
"testing"

"github.com/rotationalio/vanity/server/render"
"github.com/stretchr/testify/require"
"go.rtnl.ai/vanity/server/render"
)

func TestText(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions server/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"net/http"

"github.com/julienschmidt/httprouter"
"github.com/rotationalio/vanity"
"github.com/rotationalio/vanity/logger"
"github.com/rotationalio/vanity/server/middleware"
"go.rtnl.ai/vanity"
"go.rtnl.ai/vanity/logger"
"go.rtnl.ai/vanity/server/middleware"
)

// Sets up the server's middleware and routes.
Expand Down
6 changes: 3 additions & 3 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
"time"

"github.com/julienschmidt/httprouter"
"github.com/rotationalio/vanity"
"github.com/rotationalio/vanity/config"
"github.com/rotationalio/vanity/logger"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"go.rtnl.ai/vanity"
"go.rtnl.ai/vanity/config"
"go.rtnl.ai/vanity/logger"
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions server/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"time"

"github.com/julienschmidt/httprouter"
"github.com/rotationalio/vanity"
"github.com/rotationalio/vanity/server/render"
"go.rtnl.ai/vanity"
"go.rtnl.ai/vanity/server/render"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion server/vanity.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"

"github.com/julienschmidt/httprouter"
"github.com/rotationalio/vanity"
"go.rtnl.ai/vanity"
)

func Vanity(pkg *vanity.GoPackage) httprouter.Handle {
Expand Down
2 changes: 1 addition & 1 deletion server/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"

"github.com/julienschmidt/httprouter"
"github.com/rotationalio/vanity"
"go.rtnl.ai/vanity"
)

//go:embed all:templates
Expand Down
2 changes: 1 addition & 1 deletion vanity.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"path/filepath"
"strings"

"github.com/rotationalio/vanity/config"
"go.rtnl.ai/vanity/config"
"gopkg.in/yaml.v3"
)

Expand Down
4 changes: 2 additions & 2 deletions vanity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"net/url"
"testing"

. "github.com/rotationalio/vanity"
"github.com/rotationalio/vanity/config"
"github.com/stretchr/testify/require"
. "go.rtnl.ai/vanity"
"go.rtnl.ai/vanity/config"
)

type expected struct {
Expand Down
4 changes: 2 additions & 2 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const (
VersionReleaseNumber = 1
)

// Set the GitVersion via -ldflags="-X 'github.com/rotationalio/vanity.GitVersion=$(git rev-parse --short HEAD)'"
// Set the GitVersion via -ldflags="-X 'go.rtnl.ai/vanity.GitVersion=$(git rev-parse --short HEAD)'"
var GitVersion string

// Set the BuildDate via -ldflags="-X github.com/rotationalio/vanity.BuildDate=YYYY-MM-DD"
// Set the BuildDate via -ldflags="-X go.rtnl.ai/vanity.BuildDate=YYYY-MM-DD"
var BuildDate string

// Version returns the semantic version for the current build.
Expand Down

0 comments on commit 8d0660d

Please sign in to comment.