diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2021-07-04 15:33:18 +0100 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2021-07-04 15:33:18 +0100 |
| commit | 80b5a6680e2fc4d2f1e425ff2e5f1cfbbd529d9e (patch) | |
| tree | 6286c7d490ebfe4b8c1013dbb2807e8c55e0d71d /internal/lib.go | |
| parent | 8c5aaad11e949adfd1545b7802899b81f7d74ed5 (diff) | |
Simplify project structure
Diffstat (limited to 'internal/lib.go')
| -rw-r--r-- | internal/lib.go | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/internal/lib.go b/internal/lib.go deleted file mode 100644 index 742a9c7..0000000 --- a/internal/lib.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2019, Grégoire Duchêne <gduchene@awhk.org> -// -// Use of this source code is governed by the ISC license that can be -// found in the LICENSE file. - -package internal - -import ( - "fmt" - "os" - "strings" -) - -func GetBody(pkg string) string { - dest := GetDest(os.Getenv("PREFIX"), os.Getenv("DEST"), pkg) - return fmt.Sprintf(`<!doctype html> -<meta name="go-import" content="%s %s %s"> -<title>go-import-redirect</title> -`, pkg, os.Getenv("VCS"), dest) -} - -func GetDest(srcPrefix, destPrefix, pkg string) string { - srcPrefix = strings.TrimRight(srcPrefix, "/") - destPrefix = strings.TrimRight(destPrefix, "/") - path := strings.TrimLeft(strings.TrimPrefix(pkg, srcPrefix), "/") - return destPrefix + "/" + strings.Split(path, "/")[0] -} |
