A vanity urls/domain for golang packages.
Go to file
iratusmachina 5867270d87 Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
sample Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
templates Adding other files 2024-05-06 03:20:30 -04:00
testData Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
.gitignore Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
Makefile Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
README.md Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
app.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
bytesize.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
bytesize_test.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
conf.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
conf_test.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
embed.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
go.mod Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
go.sum Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
handlers.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
handlers_test.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
logger.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
logger_test.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
main.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00
middleware.go Adding other files 2024-05-06 03:20:30 -04:00
testUtils_test.go Adding log rotation done by the app. Adding tests (integration and unit) 2024-07-01 00:15:13 -04:00

README.md

GocustomUrls

This is a homespun implementation of the practice of using custom import paths for go modules.

This package basically returns a html document with a prefilled meta tag

<meta name="go-import" content="{package} git {url location of the package}">

There are ways to do this with nginx or hugo but I wanted to:

  • host on a subdomain
  • not muck up my ngnix config

So I used golang for this project.

Running

$ ./artifacts/gocustomurls --conf <PATH_TO_CONF_FILE>

A sample config file is located here

SystemD

A sample systemd file is located here

Testing

You can test with

(a) httpie

$ http --body "https://{domain.name}/{package}?go-get=1"
...Truncated output

(b) With the go-get command

$ go get -v -u jbowen.dev/cereal
get "jbowen.dev/cereal": found meta tag get.metaImport{Prefix:"jbowen.dev/cereal", VCS:"git", RepoRoot:"https://github.com/jamesbo13/cereal"} at //jbowen.dev/cereal?go-get=1
jbowen.dev/cereal (download)

TODOs

  • Fix permission errors around opening the app.log and rules.json.
  • Make the flags (config, rules) required instead of optional. * Figure how to use logrotate (a linux utility)
  • Figure how to do log rotation as part of this app's function
  • Add tests
  • Figure how to use goreleaser here to release deb and rpm packages (so basically split it, goreleaser for github and woodpecker for Woodpecker)
  • Update README.md