Using Makefile to Simplify Project Checks

In this article, I’ll explain how I use Makefile to streamline some routine checks in my projects. Makefile is a simple and powerful tool that helps automate repetitive tasks, commonly used in build and compilation processes. With its straightforward syntax, it allows you to define commands and workflows, making everyday tasks faster and more efficient.

Some steps I often include in my Makefile are:

  • go mod tidy: Cleans up unused or missing dependencies in your Go modules.
  • go fmt: Formats your Go code to follow the official style guide.
  • goimports: Organizes imports and formats your code.
  • golangci-lint: Runs a fast and configurable linter to catch potential issues.

With this configuration, you can trigger the test command by simply running make test, or even include it in a pipeline of sequential commands.

For example, running Go tests with specific tags can be streamlined like this:

go test -shuffle=on -race -timeout=30s ./...         

Makefile helps keep these commands consistent and easier to execute, improving your workflow.

Mauro Marins

Senior .NET Software Engineer | Senior Full Stack Developer | C# | .Net Framework | Azure | React | SQL | Microservices

2 个月

Great article! Thanks for sharing!

Jader Lima

Data Engineer | Azure | Azure Databricks | Azure Data Factory | Azure Data Lake | Azure SQL | Databricks | PySpark | Apache Spark | Python

2 个月

Great Content ! thanks for sharing !

Alexandre Germano Souza de Andrade

Senior Software Engineer | Backend-Focused Fullstack Developer | .NET | C# | Angular | TypeScript | JavaScript | Azure | SQL Server

2 个月

Nice post Silvio Ubaldino, thanks for sharing!

要查看或添加评论,请登录

Silvio Ubaldino的更多文章

社区洞察

其他会员也浏览了