# GocustomUrls This is a homespun implementation of the practice of [using custom import paths for go modules](https://pkg.go.dev/cmd/go#hdr-Remote_import_paths). This package basically returns a html document with a prefilled meta tag ```html ``` There are ways to do this with [nginx](https://www.nirenjan.com/2019/golang-vanity-urls-in-nginx/) or [hugo](https://blog.jbowen.dev/2020/07/using-go-vanity-urls-with-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](https://httpie.io/) ```sh $ http --body "https://{domain.name}/{package}?go-get=1" ...truncated output ``` (b) With the go-get command ```sh $ 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) ``` ### Sample logrotate config Initial ```json ~/.gocustomurls/logs/app.log { size 20M copytruncate compress notifempty delaycompress } ``` To fix this error ```sh rotating pattern: /home/bloguser/.gocustomurls/logs/app.log forced from command line (no old logs will be kept) empty log files are not rotated, old logs are removed considering log /home/bloguser/.gocustomurls/logs/app.log error: skipping "/home/bloguser/.gocustomurls/logs/app.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation. ``` do this instead ```json ~/.gocustomurls/logs/app.log { su bloguser bloguser size 20M copytruncate compress notifempty delaycompress } ``` ## TODOs * [x] Fix permission errors around opening the app.log and rules.json. * [x] Make the flags (config, rules) required instead of optional. * [ ] Figure how to use logrotate (a linux utility)