gocustomurls/README.md

1.2 KiB

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.

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)