-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from algolia/refacto
Refacto / update project
- Loading branch information
Showing
50 changed files
with
2,231 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
golang: | ||
docker: | ||
- image: cimg/go:1.21 | ||
|
||
jobs: | ||
lint: | ||
executor: golang | ||
steps: | ||
- checkout | ||
# Download and cache dependencies | ||
- restore_cache: &restore-cache | ||
keys: | ||
- go-mod-{{ checksum "go.sum" }} | ||
- run: | ||
name: Install dependencies | ||
command: | | ||
go mod download | ||
# This a crappy fix as https://github.com/hashicorp/go-secure-stdlib/pull/125 has not been merged | ||
CPVER="$(go list -m -json "github.com/hashicorp/go-secure-stdlib/plugincontainer"| jq -r '.Version')" | ||
if [ "${CPVER}" = "v0.3.0" ] | ||
then | ||
CPDIR="$(go list -m -json "github.com/hashicorp/go-secure-stdlib/plugincontainer"| jq -r '.Dir')" | ||
sudo sed -i 's@types\.Container@container.@g' "${CPDIR}/container_runner.go" | ||
fi | ||
- run: | ||
name: Go fmt | ||
command: | | ||
RES="$(gofmt -s -l .)" | ||
if [ -n "${RES}" ] | ||
then | ||
echo "${RES}" | ||
exit 1 | ||
fi | ||
- run: | ||
name: Install golangci-lint | ||
command: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2 | ||
- run: | ||
name: GolangCI Lint | ||
command: golangci-lint run --timeout 300s | ||
- save_cache: &save-cache | ||
paths: | ||
- /home/circleci/go/pkg/mod | ||
key: go-mod-{{ checksum "go.sum" }} | ||
test: | ||
executor: golang | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
<<: *restore-cache | ||
- run: | ||
name: Install dependencies | ||
command: | | ||
go mod download | ||
CPVER="$(go list -m -json "github.com/hashicorp/go-secure-stdlib/plugincontainer"| jq -r '.Version')" | ||
if [ "${CPVER}" = "v0.3.0" ] | ||
then | ||
CPDIR="$(go list -m -json "github.com/hashicorp/go-secure-stdlib/plugincontainer"| jq -r '.Dir')" | ||
sudo sed -i 's@types\.Container@container.@g' "${CPDIR}/container_runner.go" | ||
fi | ||
- run: | ||
name: Test | ||
command: | | ||
make test | ||
- save_cache: | ||
<<: *save-cache | ||
|
||
workflows: | ||
lint_test: | ||
jobs: | ||
- lint | ||
- test: | ||
requires: | ||
- lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
exclude_paths: | ||
- "internal/*test.go" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CODEOWNERS | ||
LICENSE | ||
Makefile | ||
README.md | ||
deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ vendor/**/ | |
nginx/**/ | ||
static/.well-known | ||
*.pem | ||
sup3rS3cretMes5age | ||
*.key | ||
/sup3rS3cretMes5age | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/algolia/sup3rS3cretMes5age/internal" | ||
) | ||
|
||
var version = "" | ||
|
||
func main() { | ||
versionFlag := flag.Bool("version", false, "Print version") | ||
flag.Parse() | ||
if *versionFlag { | ||
fmt.Println(version) | ||
os.Exit(0) | ||
} | ||
|
||
conf := internal.LoadConfig() | ||
internal.Serve(conf) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.