All Projects → vincentbernat → Hellogopher

vincentbernat / Hellogopher

Licence: other
Makefile to build a Go project

Programming Languages

golang
3204 projects

Labels

Projects that are alternatives of or similar to Hellogopher

Aosp build
AOSP Build system compatible version of Open GApps
Stars: ✭ 250 (-8.42%)
Mutual labels:  makefile
React Native Snippets
✏️ A collection of React Native snippets for Sublime Text and Atom
Stars: ✭ 257 (-5.86%)
Mutual labels:  makefile
Displaylink Rpm
RPM sources for the DisplayLink USB display adapters
Stars: ✭ 266 (-2.56%)
Mutual labels:  makefile
Optware Ng
Stars: ✭ 253 (-7.33%)
Mutual labels:  makefile
Archwsl
ArchLinux based WSL Distribution. Supports multiple install.
Stars: ✭ 3,667 (+1243.22%)
Mutual labels:  makefile
Docker To Linux
Make bootable Linux disk image abusing Docker
Stars: ✭ 257 (-5.86%)
Mutual labels:  makefile
Python Ios Support
A meta-package for building a version of Python that can be embedded into an iOS project.
Stars: ✭ 246 (-9.89%)
Mutual labels:  makefile
Packpack
Simple building of RPMs & Debian packages from git repos
Stars: ✭ 269 (-1.47%)
Mutual labels:  makefile
Ricing
a book about ricing unix-like systems
Stars: ✭ 257 (-5.86%)
Mutual labels:  makefile
Lmnplayer
完整版的ijkplayer,现在自己改一下
Stars: ✭ 263 (-3.66%)
Mutual labels:  makefile
Go Makefile Example
Example Makefile for Go projects
Stars: ✭ 254 (-6.96%)
Mutual labels:  makefile
Packages
Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
Stars: ✭ 2,957 (+983.15%)
Mutual labels:  makefile
Sshb0t
A bot for keeping your ssh authorized_keys up to date with user's GitHub keys, **only** use if you enable 2FA & keep your keys updates.
Stars: ✭ 260 (-4.76%)
Mutual labels:  makefile
Learning Nodejs
Project for learning Node.js internals
Stars: ✭ 244 (-10.62%)
Mutual labels:  makefile
Android device oneplus bacon
Stars: ✭ 267 (-2.2%)
Mutual labels:  makefile
Data Making Guidelines
📘 Making Data, the DataMade Way
Stars: ✭ 248 (-9.16%)
Mutual labels:  makefile
Poudriere
Port/Package build and test system
Stars: ✭ 257 (-5.86%)
Mutual labels:  makefile
Routeros Scripts
a collection of scripts for Mikrotik RouterOS
Stars: ✭ 270 (-1.1%)
Mutual labels:  makefile
Cookiecutter Docker Science
Cookiecutter template for data scientists working with Docker containers
Stars: ✭ 267 (-2.2%)
Mutual labels:  makefile
Arm Eabi Toolchain
Makefile & supporting patches/scripts to build a bare metal ARM EABI toolchain.
Stars: ✭ 259 (-5.13%)
Mutual labels:  makefile

Makefile for Go projects (1.11+)

This is an example of Makefile to build a Go project. This is quite similar to Filippo Valsorda's hellogopher.

Initially, this is for people who don't know about GOPATH or who don't want to use it (like me). However, starting with Go 1.11, modules enable to work outside of GOPATH without any special environment. This turns this Makefile as only a convenience tool.

Dependencies

This example relies on modules to retrieve dependencies. This requires use of Go 1.11 or more recent. To update a dependency, use go get [email protected].

For older versions of Go, it's possible to use vgo instead:

go get -u golang.org/x/vgo
make GO=$GOPATH/bin/vgo

On first build, you need to run go mod init PROJECTNAME.

Versioning

Version is extracted from git tags using anything prefixed by v.

Usage

The following commands are available:

  • make help to get help
  • make to build the binary (in bin/)
  • make test to run tests
  • make test-verbose to run tests in verbose mode
  • make test-race for race tests
  • make test-xml for tests with xUnit-compatible output
  • make test-coverage for test coverage (will output index.html, coverage.xml and profile.out in test/coverage.*/.
  • make test PKG=helloworld/hello to restrict test to a package
  • make clean
  • make lint to run golint
  • make fmt to run gofmt

The very first line of the Makefile is the most important one: this is the path of the package. I don't use a go getable package path but you can.

Be sure to browse the remaining of the Makefile to understand what it does. There are some tools that will be downloaded. You can use already-installed one by specifying their full path this way instead:

make lint GOLINT=/usr/bin/golint

Files other than .gitignore and Makefile are just examples.

Misc

If golint complains with go/build: importGo hellogopher/cmd: exit status 2, just delete it from bin/ and let the Makefile build it again.

If you prefer, you can also include this Makefile into another one. Rename it to hellogopher.mk and put in Makefile something like this:

include hellogopher.mk

# Your custom settings
TIMEOUT=10

# Your custom rules
doc: ; $(info $(M) build documentation) @ ## Build documentation
	$(MAKE) -C doc

License

This Makefile is published under the CC0 1.0 license. See LICENSE for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].