https://github.com/jashandeep-sohi/go.sohi.link
Vanity/custom Go import paths using Cloudflare Workers
https://github.com/jashandeep-sohi/go.sohi.link
cloudflare cloudflare-workers go-import golang wrangler
Last synced: 6 months ago
JSON representation
Vanity/custom Go import paths using Cloudflare Workers
- Host: GitHub
- URL: https://github.com/jashandeep-sohi/go.sohi.link
- Owner: jashandeep-sohi
- License: gpl-3.0
- Created: 2021-07-16T03:37:36.000Z (about 4 years ago)
- Default Branch: default
- Last Pushed: 2021-07-19T05:04:09.000Z (about 4 years ago)
- Last Synced: 2025-02-09T02:34:51.683Z (8 months ago)
- Topics: cloudflare, cloudflare-workers, go-import, golang, wrangler
- Language: JavaScript
- Homepage: https://go.sohi.link/
- Size: 23.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/go.sohi.link/demo)
[](https://github.com/jashandeep-sohi/go.sohi.link/actions/workflows/deploy-prod.yml)# What?
Vanity/custom Go `import "example.com/foo/pkg/bar"` paths using Cloudflare Workers.
# Where?
https://go.sohi.link/
# Why?
- Own your import paths.
- Avoid vendor lock-in (Github, Gitlab, etc).
- Do it without managing any servers or paying anything
(Cloudflare Workers are basically a version of Serverless™ w/ 100K requests/day on free tier).# How?
When you `go get go.sohi.link/go-project/pkg` it makes a `GET` request to `https://go.sohi.link/go-project/pkg?go-get=1`.
If it finds a ``
on that page, it knows to fetch the actual code from `github.com/jashandeep-sohi/go-project`
using `git` as the VCS.More details at https://pkg.go.dev/cmd/go#hdr-Remote_import_paths
This Worker just generates those `` tag pages based
on`config.yaml`.# Cookbook
Install `wrangler` CF Workers CLI:
```
$ npm install -g @cloudflare/wrangler
# OR
$ cargo install wrangler
```Login:
```
$ wrangler login
```Set required env vars:
```
$ export CF_ACCOUNT_ID=xxxx# For prod deployment only
$ export CF_ZONE_ID=xxxxx
```Local deploy:
```
$ wrangler dev
```Remote deploy:
```
$ wrangler publish
```Prod deploy:
```
$ wrangler publish --env prod
```