aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2020-03-26 22:03:15 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2020-03-26 22:03:15 +0000
commitfeff62b8fcff9709dc6c7f0b56ce80a288367f29 (patch)
tree68fe8a643179ee60d83ec2a39e1f3a4e2ac77cde
parent3216dc9b8d876f24ed561e81c2a1fb91926cb57a (diff)
Standardize the project layout
https://github.com/golang-standards/project-layout seems sensible.
-rw-r--r--cmd/aws/main.go (renamed from aws/main.go)4
-rw-r--r--cmd/gcp/main.go (renamed from gcp/main.go)4
-rw-r--r--internal/lib.go (renamed from lib/lib.go)2
-rw-r--r--internal/lib_test.go (renamed from lib/lib_test.go)2
4 files changed, 6 insertions, 6 deletions
diff --git a/aws/main.go b/cmd/aws/main.go
index 528f9b3..7954af3 100644
--- a/aws/main.go
+++ b/cmd/aws/main.go
@@ -11,7 +11,7 @@ import (
"context"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
- "go.awhk.org/go-import-redirect/lib"
+ "go.awhk.org/go-import-redirect/internal"
"net/http"
"path"
)
@@ -20,7 +20,7 @@ func redirect(ctx context.Context, req events.APIGatewayProxyRequest) (events.AP
var (
pkg = path.Join(req.Headers["Host"], req.Path)
resp = events.APIGatewayProxyResponse{
- Body: lib.GetBody(pkg),
+ Body: internal.GetBody(pkg),
Headers: map[string]string{"Content-Type": "text/html; charset=utf-8"},
}
)
diff --git a/gcp/main.go b/cmd/gcp/main.go
index bb792cc..e8ad6ba 100644
--- a/gcp/main.go
+++ b/cmd/gcp/main.go
@@ -6,7 +6,7 @@
package main
import (
- "go.awhk.org/go-import-redirect/lib"
+ "go.awhk.org/go-import-redirect/internal"
"log"
"net/http"
"os"
@@ -22,7 +22,7 @@ func redirect(resp http.ResponseWriter, req *http.Request) {
resp.Header()["Location"] = []string{"https://godoc.org/" + pkg}
resp.WriteHeader(http.StatusFound)
}
- resp.Write([]byte(lib.GetBody(pkg)))
+ resp.Write([]byte(internal.GetBody(pkg)))
}
func main() {
diff --git a/lib/lib.go b/internal/lib.go
index a35cb13..742a9c7 100644
--- a/lib/lib.go
+++ b/internal/lib.go
@@ -3,7 +3,7 @@
// Use of this source code is governed by the ISC license that can be
// found in the LICENSE file.
-package lib
+package internal
import (
"fmt"
diff --git a/lib/lib_test.go b/internal/lib_test.go
index 7b46bfb..19a880d 100644
--- a/lib/lib_test.go
+++ b/internal/lib_test.go
@@ -3,7 +3,7 @@
// Use of this source code is governed by the ISC license that can be
// found in the LICENSE file.
-package lib
+package internal
import "testing"