Skip to content

Instantly share code, notes, and snippets.

@Inquizarus
Last active June 26, 2018 10:07
Show Gist options
  • Save Inquizarus/82793bed195c2df6943d303c8f663300 to your computer and use it in GitHub Desktop.
Save Inquizarus/82793bed195c2df6943d303c8f663300 to your computer and use it in GitHub Desktop.

Revisions

  1. Conny Karlsson revised this gist Jun 26, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion golang-makefile
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ GOBUILD=$(GOCMD) build
    GOCLEAN=$(GOCMD) clean
    GOTEST=$(GOCMD) test
    GOGET=$(GOCMD) get
    BINARY_NAME=makego
    BINARY_NAME={{binary_name}}
    BINARY_UNIX=$(BINARY_NAME)_unix

    all: test build
  2. Conny Karlsson revised this gist Jun 26, 2018. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions golang-makefile
    Original file line number Diff line number Diff line change
    @@ -4,25 +4,25 @@ GOBUILD=$(GOCMD) build
    GOCLEAN=$(GOCMD) clean
    GOTEST=$(GOCMD) test
    GOGET=$(GOCMD) get
    BINARY_NAME={{binary_name}}
    BINARY_NAME=makego
    BINARY_UNIX=$(BINARY_NAME)_unix

    all: test build
    build:
    $(GOBUILD) -o $(BINARY_NAME) -v
    $(GOBUILD) -o $(BINARY_NAME) -v
    test:
    $(GOTEST) -v ./...
    $(GOTEST) -v ./...
    clean:
    $(GOCLEAN)
    rm -f $(BINARY_NAME)
    rm -f $(BINARY_UNIX)
    $(GOCLEAN)
    rm -f $(BINARY_NAME)
    rm -f $(BINARY_UNIX)
    run:
    $(GOBUILD) -o $(BINARY_NAME) -v ./...
    ./$(BINARY_NAME)
    $(GOBUILD) -o $(BINARY_NAME) -v ./...
    ./$(BINARY_NAME)


    # Cross compilation
    build-linux:
    CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v
    CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v
    docker-build:
    docker run --rm -it -v "$(GOPATH)":/go -w /go/src/bitbucket.org/rsohlich/makepost golang:latest go build -o "$(BINARY_UNIX)" -v
    docker run --rm -it -v "$(GOPATH)":/go -w /go/src/bitbucket.org/rsohlich/makepost golang:latest go build -o "$(BINARY_UNIX)" -v
  3. Conny Karlsson renamed this gist Jun 26, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. Conny Karlsson revised this gist Jun 26, 2018. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion golang.mk
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    # Go parameters
    GOCMD=go
    GOBUILD=$(GOCMD) build
  5. Conny Karlsson renamed this gist Jun 26, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. Conny Karlsson created this gist Jun 26, 2018.
    29 changes: 29 additions & 0 deletions project.mk
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@

    # Go parameters
    GOCMD=go
    GOBUILD=$(GOCMD) build
    GOCLEAN=$(GOCMD) clean
    GOTEST=$(GOCMD) test
    GOGET=$(GOCMD) get
    BINARY_NAME={{binary_name}}
    BINARY_UNIX=$(BINARY_NAME)_unix

    all: test build
    build:
    $(GOBUILD) -o $(BINARY_NAME) -v
    test:
    $(GOTEST) -v ./...
    clean:
    $(GOCLEAN)
    rm -f $(BINARY_NAME)
    rm -f $(BINARY_UNIX)
    run:
    $(GOBUILD) -o $(BINARY_NAME) -v ./...
    ./$(BINARY_NAME)


    # Cross compilation
    build-linux:
    CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v
    docker-build:
    docker run --rm -it -v "$(GOPATH)":/go -w /go/src/bitbucket.org/rsohlich/makepost golang:latest go build -o "$(BINARY_UNIX)" -v