Skip to content

Commit

Permalink
Summary: Minor bugfix + crosscompile binary
Browse files Browse the repository at this point in the history
  • Loading branch information
leowmjw committed Jun 17, 2019
1 parent 1a8cdcc commit f938cc8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# Ignore binary
go-pardocs

# Ignore dist binary
dist/*

# Ignore direnv
.envrc*

Expand Down
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,19 @@ build:
@go build ./cmd/go-pardocs

test:
@go test .
@go test ./...

# https://vic.demuzere.be/articles/golang-makefile-crosscompile/
PLATFORMS := linux/amd64 windows/amd64 darwin/amd64

temp = $(subst /, ,$@)
os = $(word 1, $(temp))
arch = $(word 2, $(temp))

release: $(PLATFORMS)

$(PLATFORMS):
@mkdir -p dist/$(os)-$(arch)
@GOOS=$(os) GOARCH=$(arch) go build -o './dist/$(os)-$(arch)/go-pardocs' ./cmd/go-pardocs

.PHONY release: $(PLATFORMS)
5 changes: 5 additions & 0 deletions dist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Platform specific binaries

- Genetrated by ```make release```
- Cross-compile binary for release

2 changes: 1 addition & 1 deletion internal/hansard/pdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewPDFDoc(sourcePath string) (*PDFDocument, error) {

exerr := pdfDoc.extractPDF()
if exerr != nil {
panic(exerr)
return nil, exerr
}
return &pdfDoc, nil

Expand Down

0 comments on commit f938cc8

Please sign in to comment.