Skip to content

Commit

Permalink
Add make target "format" to run "go fmt" on Go files.
Browse files Browse the repository at this point in the history
  • Loading branch information
fancycode committed Sep 21, 2018
1 parent 57acea2 commit ca17376
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ AC_SUBST(HAVE_GO)
AM_CONDITIONAL(MINGW, expr $host : '.*-mingw' >/dev/null 2>&1)

AM_INIT_AUTOMAKE([foreign])
AM_EXTRA_RECURSIVE_TARGETS([test])
AM_EXTRA_RECURSIVE_TARGETS([format test])

AX_CXX_COMPILE_STDCXX_11()

Expand Down
8 changes: 8 additions & 0 deletions examples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,12 @@ gopath:

heif-test-go: gopath $(top_builddir)/libheif/libheif.la $(top_builddir)/libheif.pc heif-test.go
GOPATH=${CURDIR} PKG_CONFIG_PATH=$(abs_top_builddir) CGO_CFLAGS="-I$(abs_top_builddir)" CGO_LDFLAGS="-L$(abs_top_builddir)/libheif/.libs" LD_LIBRARY_PATH=$(abs_top_builddir)/libheif/.libs $(GO) build -o heif-test-go heif-test.go

format-go: heif-test.go
$(GO) fmt heif-test.go
else
format-go:
echo ""go" not present in "${PATH}", skipping formatting"
endif

format-local: format-go
8 changes: 8 additions & 0 deletions go/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ gopath:
if HAVE_GO
test-go: gopath $(top_builddir)/libheif/libheif.la $(top_builddir)/libheif.pc
GOPATH=${CURDIR} PKG_CONFIG_PATH=$(abs_top_builddir) CGO_CFLAGS="-I$(abs_top_builddir)" CGO_LDFLAGS="-L$(abs_top_builddir)/libheif/.libs" LD_LIBRARY_PATH=$(abs_top_builddir)/libheif/.libs $(GO) test -v heif

format-go: gopath
GOPATH=${CURDIR} $(GO) fmt heif
else
test-go:
echo ""go" not present in "${PATH}", skipping tests"

format-go:
echo ""go" not present in "${PATH}", skipping formatting"
endif

test-local: test-go

format-local: format-go

0 comments on commit ca17376

Please sign in to comment.