Skip to content

Commit

Permalink
Merge pull request #207 from slashdevops/chore-update
Browse files Browse the repository at this point in the history
chore: dependencies update and Makefile improvement
  • Loading branch information
christiangda authored Mar 10, 2024
2 parents bf8d172 + b3375b0 commit a164904
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 200 deletions.
82 changes: 0 additions & 82 deletions .github/workflows/codeql.yml

This file was deleted.

50 changes: 21 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,62 +77,56 @@ $(if $(filter $(MAKE_DEBUG),true),\

endef # don't remove the whiteline before endef

######## Targets ########
##@ all
###############################################################################
######## Targets ##############################################################
##@ Default command
.PHONY: all
all: clean test build
all: clean test build ## Clean, test and build the application. Execute by default when make is called without arguments

##@ go-fmt
###############################################################################
##@ Golang commands
.PHONY: go-fmt
go-fmt: ## Format go code
@printf "👉 Formatting go code...\n"
$(call exec_cmd, go fmt ./... )

##@ go-vet
.PHONY: go-vet
go-vet: ## Vet go code
@printf "👉 Vet go code...\n"
$(call exec_cmd, go vet ./... )

##@ go-genereate
.PHONY: go-generate
go-generate: ## Generate go code
@printf "👉 Generating go code...\n"
$(call exec_cmd, go generate ./... )

##@ go-mod-tidy
.PHONY: go-mod-tidy
go-mod-tidy: ## Clean go.mod and go.sum
@printf "👉 Cleaning go.mod and go.sum...\n"
$(call exec_cmd, go mod tidy)

##@ go-mod-update
.PHONY: go-mod-update
go-mod-update: go-mod-tidy ## Update go.mod and go.sum
@printf "👉 Updating go.mod and go.sum...\n"
$(foreach DEP, $(PROJECT_DEPENDENCIES), \
$(call exec_cmd, go get -u $(DEP)) \
)

##@ go-mod-vendor
.PHONY: go-mod-vendor
go-mod-vendor: ## Create mod vendor
@printf "👉 Creating mod vendor...\n"
$(call exec_cmd, go mod vendor)

##@ go-mod-verify
.PHONY: go-mod-verify
go-mod-verify: ## Verify go.mod and go.sum
@printf "👉 Verifying go.mod and go.sum...\n"
$(call exec_cmd, go mod verify)

##@ go-mod-download
.PHONY: go-mod-download
go-mod-download: ## Download go dependencies
@printf "👉 Downloading go dependencies...\n"
$(call exec_cmd, go mod download)

##@ go-mod-graph
.PHONY: go-mod-graph
go-mod-graph: ## Create a file with the go dependencies graph in build dir
@printf "👉 Printing go dependencies graph...\n"
Expand All @@ -144,7 +138,13 @@ $(PROJECT_COVERAGE_FILE):
$(call exec_cmd, mkdir -p $(BUILD_DIR) )
$(call exec_cmd, touch $(PROJECT_COVERAGE_FILE) )

##@ test
.PHONY: go-test-coverage
go-test-coverage: test ## Shows in you browser the test coverage report per package
@printf "👉 Running got tool coverage...\n"
$(call exec_cmd, go tool cover -html=$(PROJECT_COVERAGE_FILE))

###############################################################################
##@ Test commands
.PHONY: test
test: $(PROJECT_COVERAGE_FILE) go-mod-tidy go-fmt go-vet go-generate ## Run tests
@printf "👉 Running tests...\n"
Expand All @@ -156,13 +156,8 @@ test: $(PROJECT_COVERAGE_FILE) go-mod-tidy go-fmt go-vet go-generate ## Run test
./... \
)

##@ go-test-coverage
.PHONY: go-test-coverage
go-test-coverage: test ## Shows in you browser the test coverage report per package
@printf "👉 Running got tool coverage...\n"
$(call exec_cmd, go tool cover -html=$(PROJECT_COVERAGE_FILE))

##@ build
###############################################################################
##@ Build commands
.PHONY: build
build: go-generate go-fmt go-vet test ## Build the application
@printf "👉 Building applications...\n"
Expand All @@ -171,7 +166,6 @@ build: go-generate go-fmt go-vet test ## Build the application
$(call exec_cmd, chmod +x $(BUILD_DIR)/$(proj_mod) ) \
)

##@ build-dist
.PHONY: build-dist
build-dist: ## Build the application for all platforms defined in GO_OS and GO_ARCH in this Makefile
@printf "👉 Building application for different platforms...\n"
Expand All @@ -184,7 +178,6 @@ build-dist: ## Build the application for all platforms defined in GO_OS and GO_A
)\
)

##@ build-dist-zip
.PHONY: build-dist-zip
build-dist-zip: ## Build the application for all platforms defined in GO_OS and GO_ARCH in this Makefile and create a zip file for each binary
@printf "👉 Creating zip files for distribution...\n"
Expand All @@ -198,21 +191,23 @@ build-dist-zip: ## Build the application for all platforms defined in GO_OS and
) \
)

###############################################################################
# This target is used by AWS SAM build command
# and was added to build the binary using custom flags
# Ref:
# + https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/building-custom-runtimes.html
# + https://jiangsc.me/2021/01/24/Lessons-Learnt-On-Deploying-GO-Lambda-Application-on-AWS/
# NOTES:
# + The ARTIFACTS_DIR environment variable is injected by AWS SAM build command
##@ build-LambdaFunction
##@ AWS Lambda commands
.PHONY: build-LambdaFunction
build-LambdaFunction: ## Build the application for AWS Lambda, this target is used by AWS SAM build command
@printf "👉 Called from sam build command ...\n"
@printf " 👉 ARTIFACTS_DIR injected from sam build command: %s\n" $(ARTIFACTS_DIR)
$(call exec_cmd, GOOS=$(AWS_SAM_OS) GOARCH=$(AWS_SAM_ARCH) CGO_ENABLED=$(GO_CGO_ENABLED) go build $(GO_LDFLAGS) $(GO_OPTS) -tags lambda.norpc -o $(ARTIFACTS_DIR)/$(AWS_SAM_LAMBDA_BINARY_NAME) ./cmd/$(AWS_SAM_PROJECT_APP_NAME)/ )

##@ container-build
###############################################################################
##@ Container commands
.PHONY: container-build
container-build: build-dist ## Build the container image
@printf "👉 Building container image...\n"
Expand All @@ -235,7 +230,6 @@ container-build: build-dist ## Build the container image
) \
)

##@ container-publish-docker
.PHONY: container-publish-docker
container-publish-docker: ## Publish the container image to docker hub
@printf "👉 Publishing container image to docker hub...\n"
Expand Down Expand Up @@ -271,7 +265,6 @@ container-publish-docker: ## Publish the container image to docker hub
) \
)

##@ container-publish-github
.PHONY: container-publish-github
container-publish-github: ## Publish the container image to github container registry
@printf "👉 Publishing container image to github container registry...\n"
Expand Down Expand Up @@ -307,7 +300,6 @@ container-publish-github: ## Publish the container image to github container reg
) \
)

##@ container-publish-aws-ecr
.PHONY: container-publish-aws-ecr
container-publish-aws-ecr: ## Publish the container image to AWS ECR
@printf "👉 Publishing container image to AWS ECR...\n"
Expand Down Expand Up @@ -343,14 +335,14 @@ container-publish-aws-ecr: ## Publish the container image to AWS ECR
) \
)

##@ clean
###############################################################################
##@ Support Commands
.PHONY: clean
clean: ## Clean the environment
@printf "👉 Cleaning environment...\n"
$(call exec_cmd, go clean -n -x -i)
$(call exec_cmd, rm -rf $(BUILD_DIR) $(DIST_DIR) .aws-sam ./build.toml ./packaged.yaml )

##@ help
.PHONY: help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; \
Expand Down
60 changes: 30 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,52 @@ go 1.22

require (
github.com/aws/aws-lambda-go v1.46.0
github.com/aws/aws-sdk-go-v2 v1.25.2
github.com/aws/aws-sdk-go-v2/config v1.27.3
github.com/aws/aws-sdk-go-v2/credentials v1.17.3
github.com/aws/aws-sdk-go-v2/service/s3 v1.51.0
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.1
github.com/aws/aws-sdk-go-v2 v1.25.3
github.com/aws/aws-sdk-go-v2/config v1.27.7
github.com/aws/aws-sdk-go-v2/credentials v1.17.7
github.com/aws/aws-sdk-go-v2/service/s3 v1.51.4
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.28.2
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-retryablehttp v0.7.5
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
golang.org/x/oauth2 v0.17.0
google.golang.org/api v0.167.0
github.com/stretchr/testify v1.9.0
golang.org/x/oauth2 v0.18.0
google.golang.org/api v0.169.0
gopkg.in/yaml.v3 v3.0.1
)

require (
cloud.google.com/go/compute v1.23.4 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.1 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.3 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.3 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.3 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.2 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.4 // indirect
github.com/aws/smithy-go v1.20.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.1 // indirect
github.com/googleapis/gax-go/v2 v2.12.2 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand All @@ -65,20 +65,20 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect
go.opentelemetry.io/otel v1.23.0 // indirect
go.opentelemetry.io/otel/metric v1.23.0 // indirect
go.opentelemetry.io/otel/trace v1.23.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/grpc v1.61.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240304161311-37d4d3c04a78 // indirect
google.golang.org/grpc v1.62.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
Loading

0 comments on commit a164904

Please sign in to comment.