Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""
from __future__ import print_function
import os, sys
import shutil
from subprocess import Popen

# Get the root project directory
Expand Down Expand Up @@ -37,23 +36,39 @@ def init_git():
git.wait()

def init_proto():
print ("Fetching go modules, might take a few minutes")
code = Popen(["go","mod", "download", "all"], cwd=PROJECT_DIRECTORY).wait()
if code > 0:
print("Starting proto initialization...")
print("Step 1/5: Fetching Go modules (this might take a few minutes)...")
code = Popen(["go", "mod", "download", "all"], cwd=PROJECT_DIRECTORY).wait()
if code != 0:
print("Error: Failed to fetch Go modules.")
sys.exit(code)
code = Popen(["make","install"], cwd=PROJECT_DIRECTORY).wait()
if code > 0:

print("Step 2/5: Running 'make install'...")
code = Popen(["make", "install"], cwd=PROJECT_DIRECTORY).wait()
if code != 0:
print("Error: 'make install' failed.")
sys.exit(code)
code = Popen(["make","generate"], cwd=PROJECT_DIRECTORY).wait()
if code > 0:

print("Step 3/5: Running 'make generate'...")
code = Popen(["make", "generate"], cwd=PROJECT_DIRECTORY).wait()
if code != 0:
print("Error: 'make generate' failed.")
sys.exit(code)
code = Popen(["go","mod", "tidy"], cwd=PROJECT_DIRECTORY).wait()
if code > 0:

print("Step 4/5: Tidying Go modules...")
code = Popen(["go", "mod", "tidy"], cwd=PROJECT_DIRECTORY).wait()
if code != 0:
print("Error: 'go mod tidy' failed.")
sys.exit(code)
code = Popen(["make","mock"], cwd=PROJECT_DIRECTORY).wait()
if code > 0:

print("Step 5/5: Running 'make mock'...")
code = Popen(["make", "mock"], cwd=PROJECT_DIRECTORY).wait()
if code != 0:
print("Error: 'make mock' failed.")
sys.exit(code)
Comment thread
coderabbitai[bot] marked this conversation as resolved.

print("Proto initialization completed successfully.")


def remove_docker_files():
"""
Expand Down
5 changes: 4 additions & 1 deletion {{cookiecutter.app_name}}/.github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,7 @@ jobs:
with:
go-version: "{{cookiecutter.docker_build_image_version}}"
- name: Lint
run: make lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.8
Comment thread
ankurs marked this conversation as resolved.
args: --timeout 5m
34 changes: 28 additions & 6 deletions {{cookiecutter.app_name}}/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
issues:
exclude-rules:
- path: '(.+)_test\.go'
linters:
- funlen
- goconst
version: "2"
linters:
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- funlen
- goconst
- errcheck
- ineffassign
- staticcheck
path: (.+)_test\.go
paths:
- third_party$
- builtin$
- examples$
formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion {{cookiecutter.app_name}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ install:
go install \
github.com/vektra/mockery/v2 \
github.com/bufbuild/buf/cmd/buf \
github.com/golangci/golangci-lint/cmd/golangci-lint
github.com/golangci/golangci-lint/v2/cmd/golangci-lint

generate: install
buf generate --path proto/*.proto
Expand Down
Loading
Loading