Skip to content

Commit

Permalink
Workaround for packr bug
Browse files Browse the repository at this point in the history
  • Loading branch information
midstar committed Feb 17, 2019
1 parent 20c6b9e commit 0984e46
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ for /f %%i in ('git rev-parse HEAD') do set GITHASH=%%i
echo git hash: %GITHASH%
echo building / installing
cd %GOPATH%\src\github.com\midstar\mediaweb
REM packr2 has a bug in Windows where absolute paths are generated instead
REM of relative paths. We use --legacy to fix this
REM set PACKRCMD=packr2 --legacy
REM echo %PACKRCMD%
REM %PACKRCMD%
set INSTALLCMD=packr2 build -ldflags="-X 'main.applicationBuildTime=%DATE% %TIME%' -X main.applicationVersion=%VERSION% -X main.applicationGitHash=%GITHASH%" github.com/midstar/mediaweb
set PACKRCMD=packr2
echo %PACKRCMD%
%PACKRCMD%
REM There is a bug in packr that creates absolute paths in main-packr.go on some
REM build machines (uncertain why). Replace main-packr.go with a new file
echo Replacing main-packr.go due to a bug in packr library
echo // +build !skippackr > main-packr.go
echo package main >> main-packr.go
echo import _ "github.com/midstar/mediaweb/packrd" >> main-packr.go
set INSTALLCMD=go build -ldflags="-X 'main.applicationBuildTime=%DATE% %TIME%' -X main.applicationVersion=%VERSION% -X main.applicationGitHash=%GITHASH%" github.com/midstar/mediaweb
echo %INSTALLCMD%
%INSTALLCMD%

0 comments on commit 0984e46

Please sign in to comment.