Update src.techknowlogick.com/xgo commit hash to c43d4c4 (#224)

Update src.techknowlogick.com/xgo commit hash to c43d4c4

Reviewed-on: vikunja/api#224
This commit is contained in:
renovate 2020-04-07 07:28:48 +00:00 committed by konrad
parent cbf01e118a
commit 1448d9de98
10 changed files with 151 additions and 226 deletions

2
go.mod
View File

@ -78,7 +78,7 @@ require (
gopkg.in/d4l3k/messagediff.v1 v1.2.1 gopkg.in/d4l3k/messagediff.v1 v1.2.1
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a
src.techknowlogick.com/xgo v0.0.0-20190507142556-a5b29ecb0ff4 src.techknowlogick.com/xgo v0.0.0-20200319213703-c43d4c44a6ac
src.techknowlogick.com/xormigrate v1.1.0 src.techknowlogick.com/xormigrate v1.1.0
xorm.io/builder v0.3.6 xorm.io/builder v0.3.6
xorm.io/core v0.7.3 xorm.io/core v0.7.3

2
go.sum
View File

@ -476,6 +476,8 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a h1:LJwr7TCTghdatWv40WobzlK
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
src.techknowlogick.com/xgo v0.0.0-20190507142556-a5b29ecb0ff4 h1:DZKMg4qnT7UIyB5ZaC6ZqltF2K5KhA1oQ2PdxOLZ3jg= src.techknowlogick.com/xgo v0.0.0-20190507142556-a5b29ecb0ff4 h1:DZKMg4qnT7UIyB5ZaC6ZqltF2K5KhA1oQ2PdxOLZ3jg=
src.techknowlogick.com/xgo v0.0.0-20190507142556-a5b29ecb0ff4/go.mod h1:Ood88figJtEukTnU20P1IrXhyAkbOIGi4YzmeHVtGH0= src.techknowlogick.com/xgo v0.0.0-20190507142556-a5b29ecb0ff4/go.mod h1:Ood88figJtEukTnU20P1IrXhyAkbOIGi4YzmeHVtGH0=
src.techknowlogick.com/xgo v0.0.0-20200319213703-c43d4c44a6ac h1:7yl6vmo+RWjT/qFoMlJE1smvs83j/c7x9sDNTz3n/BM=
src.techknowlogick.com/xgo v0.0.0-20200319213703-c43d4c44a6ac/go.mod h1:31CE1YKtDOrKTk9PSnjTpe6YbO6W/0LTYZ1VskL09oU=
src.techknowlogick.com/xormigrate v1.1.0 h1:Ob79c1pOO+voMB9roa2eHZByT+TODwC51+Mn9e3HoTI= src.techknowlogick.com/xormigrate v1.1.0 h1:Ob79c1pOO+voMB9roa2eHZByT+TODwC51+Mn9e3HoTI=
src.techknowlogick.com/xormigrate v1.1.0/go.mod h1:IMdvIk60uPX+IUsaXbdtqFzl3n7PfRg/cSZxxsiCWf8= src.techknowlogick.com/xormigrate v1.1.0/go.mod h1:IMdvIk60uPX+IUsaXbdtqFzl3n7PfRg/cSZxxsiCWf8=
xorm.io/builder v0.3.6 h1:ha28mQ2M+TFx96Hxo+iq6tQgnkC9IZkM6D8w9sKHHF8= xorm.io/builder v0.3.6 h1:ha28mQ2M+TFx96Hxo+iq6tQgnkC9IZkM6D8w9sKHHF8=

2
vendor/modules.txt vendored
View File

@ -271,7 +271,7 @@ honnef.co/go/tools/staticcheck/vrp
honnef.co/go/tools/stylecheck honnef.co/go/tools/stylecheck
honnef.co/go/tools/unused honnef.co/go/tools/unused
honnef.co/go/tools/version honnef.co/go/tools/version
# src.techknowlogick.com/xgo v0.0.0-20190507142556-a5b29ecb0ff4 # src.techknowlogick.com/xgo v0.0.0-20200319213703-c43d4c44a6ac
src.techknowlogick.com/xgo src.techknowlogick.com/xgo
# src.techknowlogick.com/xormigrate v1.1.0 # src.techknowlogick.com/xormigrate v1.1.0
src.techknowlogick.com/xormigrate src.techknowlogick.com/xormigrate

View File

@ -1,4 +1,4 @@
local BuildSwitchDryRun(version='go-latest', tags='latest', dry=false) = { local BuildSwitchDryRun(version='go-latest', tags='latest', dry=false, depends='') = {
name: if dry then 'dry-run-' + version else 'build-' + version, name: if dry then 'dry-run-' + version else 'build-' + version,
pull: 'always', pull: 'always',
image: 'plugins/docker', image: 'plugins/docker',
@ -15,39 +15,36 @@ local BuildSwitchDryRun(version='go-latest', tags='latest', dry=false) = {
tags: tags, tags: tags,
dry_run: dry dry_run: dry
}, },
[if depends != '' then 'depends_on']: [
depends
],
[if !dry then 'when']: { [if !dry then 'when']: {
branch: ['master'], branch: ['master'],
event: {exclude: ['pull_request']} event: {exclude: ['pull_request']}
}, },
[if dry then 'when']: { [if dry then 'when']: {
event: {include: ['pull_request']} event: ['pull_request']
}, },
}; };
local BuildWithDiffTags(version='go-latest', tags='latest') = BuildSwitchDryRun(version, tags, false); local BuildWithDiffTags(version='go-latest', tags='latest', depends='') = BuildSwitchDryRun(version, tags, false, depends);
local BuildWithDiffTagsDry(version='go-latest', tags='latest') = BuildSwitchDryRun(version, tags, true); local BuildWithDiffTagsDry(version='go-latest', tags='latest', depends='') = BuildSwitchDryRun(version, tags, true, depends);
local BuildStep(version='go-latest') = BuildWithDiffTags(version, version); local BuildStep(version='go-latest', depends='') = BuildWithDiffTags(version, version, depends);
local BuildStepDry(version='go-latest') = BuildSwitchDryRun(version, version, true); local BuildStepDry(version='go-latest', depends='') = BuildSwitchDryRun(version, version, true, depends);
{ {
kind: 'pipeline', kind: 'pipeline',
name: 'default', name: 'default',
steps: [ steps: [
BuildStepDry('base'), BuildStepDry('base'),
BuildStepDry('go-1.12.5'), BuildStepDry('go-1.14.1', 'dry-run-base'),
BuildStepDry('go-1.11.10'), BuildStepDry('go-1.13.9', 'dry-run-base'),
BuildStep('base'), BuildStep('base'),
BuildStep('go-1.12.5'), BuildStep('go-1.14.1', 'build-base'),
BuildStep('go-1.12.x'), BuildStep('go-1.14.x', 'build-go-1.14.1'),
BuildWithDiffTags(), BuildStep('go-1.13.9', 'build-base'),
BuildStep('go-1.11.10'), BuildStep('go-1.13.x', 'build-go-1.13.9'),
BuildStep('go-1.11.x'), BuildWithDiffTags('go-latest', 'latest', 'build-go-1.14.x'),
BuildStep('go-1.12.4'),
BuildStep('go-1.12.3'),
BuildStep('go-1.12.2'),
BuildStep('go-1.12.1'),
BuildStep('go-1.12.0'),
BuildStep('go-1.11.9'),
] ]
} }

View File

@ -24,39 +24,43 @@ steps:
event: event:
- pull_request - pull_request
- name: dry-run-go-1.12.5 - name: dry-run-go-1.14.1
pull: always pull: always
image: plugins/docker image: plugins/docker
settings: settings:
context: docker/go-1.12.5 context: docker/go-1.14.1
dockerfile: docker/go-1.12.5/Dockerfile dockerfile: docker/go-1.14.1/Dockerfile
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: techknowlogick/xgo repo: techknowlogick/xgo
tags: go-1.12.5 tags: go-1.14.1
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- pull_request - pull_request
depends_on:
- dry-run-base
- name: dry-run-go-1.11.10 - name: dry-run-go-1.13.9
pull: always pull: always
image: plugins/docker image: plugins/docker
settings: settings:
context: docker/go-1.11.10 context: docker/go-1.13.9
dockerfile: docker/go-1.11.10/Dockerfile dockerfile: docker/go-1.13.9/Dockerfile
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: techknowlogick/xgo repo: techknowlogick/xgo
tags: go-1.11.10 tags: go-1.13.9
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
event: event:
- pull_request - pull_request
depends_on:
- dry-run-base
- name: build-base - name: build-base
pull: always pull: always
@ -77,16 +81,16 @@ steps:
exclude: exclude:
- pull_request - pull_request
- name: build-go-1.12.5 - name: build-go-1.14.1
pull: always pull: always
image: plugins/docker image: plugins/docker
settings: settings:
context: docker/go-1.12.5 context: docker/go-1.14.1
dockerfile: docker/go-1.12.5/Dockerfile dockerfile: docker/go-1.14.1/Dockerfile
password: password:
from_secret: docker_password from_secret: docker_password
repo: techknowlogick/xgo repo: techknowlogick/xgo
tags: go-1.12.5 tags: go-1.14.1
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
@ -95,17 +99,19 @@ steps:
event: event:
exclude: exclude:
- pull_request - pull_request
depends_on:
- build-base
- name: build-go-1.12.x - name: build-go-1.14.x
pull: always pull: always
image: plugins/docker image: plugins/docker
settings: settings:
context: docker/go-1.12.x context: docker/go-1.14.x
dockerfile: docker/go-1.12.x/Dockerfile dockerfile: docker/go-1.14.x/Dockerfile
password: password:
from_secret: docker_password from_secret: docker_password
repo: techknowlogick/xgo repo: techknowlogick/xgo
tags: go-1.12.x tags: go-1.14.x
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
@ -114,6 +120,50 @@ steps:
event: event:
exclude: exclude:
- pull_request - pull_request
depends_on:
- build-go-1.14.1
- name: build-go-1.13.9
pull: always
image: plugins/docker
settings:
context: docker/go-1.13.9
dockerfile: docker/go-1.13.9/Dockerfile
password:
from_secret: docker_password
repo: techknowlogick/xgo
tags: go-1.13.9
username:
from_secret: docker_username
when:
branch:
- master
event:
exclude:
- pull_request
depends_on:
- build-base
- name: build-go-1.13.x
pull: always
image: plugins/docker
settings:
context: docker/go-1.13.x
dockerfile: docker/go-1.13.x/Dockerfile
password:
from_secret: docker_password
repo: techknowlogick/xgo
tags: go-1.13.x
username:
from_secret: docker_username
when:
branch:
- master
event:
exclude:
- pull_request
depends_on:
- build-go-1.13.9
- name: build-go-latest - name: build-go-latest
pull: always pull: always
@ -133,157 +183,7 @@ steps:
event: event:
exclude: exclude:
- pull_request - pull_request
depends_on:
- name: build-go-1.11.10 - build-go-1.14.x
pull: always
image: plugins/docker
settings:
context: docker/go-1.11.10
dockerfile: docker/go-1.11.10/Dockerfile
password:
from_secret: docker_password
repo: techknowlogick/xgo
tags: go-1.11.10
username:
from_secret: docker_username
when:
branch:
- master
event:
exclude:
- pull_request
- name: build-go-1.11.x
pull: always
image: plugins/docker
settings:
context: docker/go-1.11.x
dockerfile: docker/go-1.11.x/Dockerfile
password:
from_secret: docker_password
repo: techknowlogick/xgo
tags: go-1.11.x
username:
from_secret: docker_username
when:
branch:
- master
event:
exclude:
- pull_request
- name: build-go-1.12.4
pull: always
image: plugins/docker
settings:
context: docker/go-1.12.4
dockerfile: docker/go-1.12.4/Dockerfile
password:
from_secret: docker_password
repo: techknowlogick/xgo
tags: go-1.12.4
username:
from_secret: docker_username
when:
branch:
- master
event:
exclude:
- pull_request
- name: build-go-1.12.3
pull: always
image: plugins/docker
settings:
context: docker/go-1.12.3
dockerfile: docker/go-1.12.3/Dockerfile
password:
from_secret: docker_password
repo: techknowlogick/xgo
tags: go-1.12.3
username:
from_secret: docker_username
when:
branch:
- master
event:
exclude:
- pull_request
- name: build-go-1.12.2
pull: always
image: plugins/docker
settings:
context: docker/go-1.12.2
dockerfile: docker/go-1.12.2/Dockerfile
password:
from_secret: docker_password
repo: techknowlogick/xgo
tags: go-1.12.2
username:
from_secret: docker_username
when:
branch:
- master
event:
exclude:
- pull_request
- name: build-go-1.12.1
pull: always
image: plugins/docker
settings:
context: docker/go-1.12.1
dockerfile: docker/go-1.12.1/Dockerfile
password:
from_secret: docker_password
repo: techknowlogick/xgo
tags: go-1.12.1
username:
from_secret: docker_username
when:
branch:
- master
event:
exclude:
- pull_request
- name: build-go-1.12.0
pull: always
image: plugins/docker
settings:
context: docker/go-1.12.0
dockerfile: docker/go-1.12.0/Dockerfile
password:
from_secret: docker_password
repo: techknowlogick/xgo
tags: go-1.12.0
username:
from_secret: docker_username
when:
branch:
- master
event:
exclude:
- pull_request
- name: build-go-1.11.9
pull: always
image: plugins/docker
settings:
context: docker/go-1.11.9
dockerfile: docker/go-1.11.9/Dockerfile
password:
from_secret: docker_password
repo: techknowlogick/xgo
tags: go-1.11.9
username:
from_secret: docker_username
when:
branch:
- master
event:
exclude:
- pull_request
... ...

2
vendor/src.techknowlogick.com/xgo/.gitignore generated vendored Normal file
View File

@ -0,0 +1,2 @@
.idea/
xgo

1
vendor/src.techknowlogick.com/xgo/.golang_hash generated vendored Normal file
View File

@ -0,0 +1 @@
f452a25dd25c9f64ff3b3e3f32802a55 -

View File

@ -1,5 +1,7 @@
# xgo - Go CGO cross compiler # xgo - Go CGO cross compiler
[![Build Status](https://cloud.drone.io/api/badges/techknowlogick/xgo/status.svg)](https://cloud.drone.io/techknowlogick/xgo)
Although Go strives to be a cross platform language, cross compilation from one Although Go strives to be a cross platform language, cross compilation from one
platform to another is not as simple as it could be, as you need the Go sources platform to another is not as simple as it could be, as you need the Go sources
bootstrapped to each platform and architecture. bootstrapped to each platform and architecture.
@ -53,10 +55,8 @@ Simply specify the import path you want to build, and xgo will do the rest:
... ...
$ ls -al $ ls -al
-rwxr-xr-x 1 root root 9995000 Nov 24 16:44 iris-android-16-arm
-rwxr-xr-x 1 root root 6776500 Nov 24 16:44 iris-darwin-10.6-386 -rwxr-xr-x 1 root root 6776500 Nov 24 16:44 iris-darwin-10.6-386
-rwxr-xr-x 1 root root 8755532 Nov 24 16:44 iris-darwin-10.6-amd64 -rwxr-xr-x 1 root root 8755532 Nov 24 16:44 iris-darwin-10.6-amd64
-rwxr-xr-x 1 root root 7114176 Nov 24 16:45 iris-ios-5.0-arm
-rwxr-xr-x 1 root root 10135248 Nov 24 16:44 iris-linux-386 -rwxr-xr-x 1 root root 10135248 Nov 24 16:44 iris-linux-386
-rwxr-xr-x 1 root root 12598472 Nov 24 16:44 iris-linux-amd64 -rwxr-xr-x 1 root root 12598472 Nov 24 16:44 iris-linux-amd64
-rwxr-xr-x 1 root root 10040464 Nov 24 16:44 iris-linux-arm -rwxr-xr-x 1 root root 10040464 Nov 24 16:44 iris-linux-arm
@ -85,20 +85,18 @@ A handful of flags can be passed to `go build`. The currently supported ones are
As newer versions of the language runtime, libraries and tools get released, As newer versions of the language runtime, libraries and tools get released,
these will get incorporated into xgo too as extensions layers to the base cross these will get incorporated into xgo too as extensions layers to the base cross
compilation image (only Go 1.3 and above will be supported). compilation image (only Go 1.13 and above will be supported).
You can select which Go release to work with through the `-go` command line flag You can select which Go release to work with through the `-go` command line flag
to xgo and if the specific release was already integrated, it will automatically to xgo and if the specific release was already integrated, it will automatically
be retrieved and installed. be retrieved and installed.
$ xgo -go 1.6.1 github.com/project-iris/iris $ xgo -go go-1.13.2 github.com/project-iris/iris
Additionally, a few wildcard release strings are also supported: Additionally, a few wildcard release strings are also supported:
- `latest` will use the latest Go release (this is the default) - `latest` will use the latest Go release (this is the default)
- `1.6.x` will use the latest point release of a specific Go version - `go-1.13.x` will use the latest point release of a specific Go version
- `1.6-develop` will use the develop branch of a specific Go version
- `develop` will use the develop branch of the entire Go repository
### Output prefixing ### Output prefixing
@ -109,10 +107,8 @@ file prefix. This can be overridden with the `-out` flag.
... ...
$ ls -al $ ls -al
-rwxr-xr-x 1 root root 9995000 Nov 24 16:44 iris-v0.3.2-android-16-arm
-rwxr-xr-x 1 root root 6776500 Nov 24 16:44 iris-v0.3.2-darwin-10.6-386 -rwxr-xr-x 1 root root 6776500 Nov 24 16:44 iris-v0.3.2-darwin-10.6-386
-rwxr-xr-x 1 root root 8755532 Nov 24 16:44 iris-v0.3.2-darwin-10.6-amd64 -rwxr-xr-x 1 root root 8755532 Nov 24 16:44 iris-v0.3.2-darwin-10.6-amd64
-rwxr-xr-x 1 root root 7114176 Nov 24 16:45 iris-v0.3.2-ios-5.0-arm
-rwxr-xr-x 1 root root 10135248 Nov 24 16:44 iris-v0.3.2-linux-386 -rwxr-xr-x 1 root root 10135248 Nov 24 16:44 iris-v0.3.2-linux-386
-rwxr-xr-x 1 root root 12598472 Nov 24 16:44 iris-v0.3.2-linux-amd64 -rwxr-xr-x 1 root root 12598472 Nov 24 16:44 iris-v0.3.2-linux-amd64
-rwxr-xr-x 1 root root 10040464 Nov 24 16:44 iris-v0.3.2-linux-arm -rwxr-xr-x 1 root root 10040464 Nov 24 16:44 iris-v0.3.2-linux-arm
@ -130,10 +126,8 @@ the desired branch name through the `--branch` argument.
... ...
$ ls -al $ ls -al
-rwxr-xr-x 1 root root 4171248 Nov 24 16:40 goimports-android-16-arm
-rwxr-xr-x 1 root root 4139868 Nov 24 16:40 goimports-darwin-10.6-386 -rwxr-xr-x 1 root root 4139868 Nov 24 16:40 goimports-darwin-10.6-386
-rwxr-xr-x 1 root root 5186720 Nov 24 16:40 goimports-darwin-10.6-amd64 -rwxr-xr-x 1 root root 5186720 Nov 24 16:40 goimports-darwin-10.6-amd64
-rwxr-xr-x 1 root root 3202364 Nov 24 16:40 goimports-ios-5.0-arm
-rwxr-xr-x 1 root root 4189456 Nov 24 16:40 goimports-linux-386 -rwxr-xr-x 1 root root 4189456 Nov 24 16:40 goimports-linux-386
-rwxr-xr-x 1 root root 5264136 Nov 24 16:40 goimports-linux-amd64 -rwxr-xr-x 1 root root 5264136 Nov 24 16:40 goimports-linux-amd64
-rwxr-xr-x 1 root root 4209416 Nov 24 16:40 goimports-linux-arm -rwxr-xr-x 1 root root 4209416 Nov 24 16:40 goimports-linux-arm
@ -163,10 +157,8 @@ parameter to select the exact package within, honoring any prior *branch* and
... ...
$ ls -al $ ls -al
-rwxr-xr-x 1 root root 4194956 Nov 24 16:38 goimports-android-16-arm
-rwxr-xr-x 1 root root 4164448 Nov 24 16:38 goimports-darwin-10.6-386 -rwxr-xr-x 1 root root 4164448 Nov 24 16:38 goimports-darwin-10.6-386
-rwxr-xr-x 1 root root 5223584 Nov 24 16:38 goimports-darwin-10.6-amd64 -rwxr-xr-x 1 root root 5223584 Nov 24 16:38 goimports-darwin-10.6-amd64
-rwxr-xr-x 1 root root 3222848 Nov 24 16:39 goimports-ios-5.0-arm
-rwxr-xr-x 1 root root 4217184 Nov 24 16:38 goimports-linux-386 -rwxr-xr-x 1 root root 4217184 Nov 24 16:38 goimports-linux-386
-rwxr-xr-x 1 root root 5295768 Nov 24 16:38 goimports-linux-amd64 -rwxr-xr-x 1 root root 5295768 Nov 24 16:38 goimports-linux-amd64
-rwxr-xr-x 1 root root 4233120 Nov 24 16:38 goimports-linux-arm -rwxr-xr-x 1 root root 4233120 Nov 24 16:38 goimports-linux-arm
@ -191,7 +183,7 @@ argument:
The supported targets are: The supported targets are:
* Platforms: `android`, `darwin`, `ios`, `linux`, `windows` * Platforms: `darwin`, `linux`, `windows`
* Achitectures: `386`, `amd64`, `arm-5`, `arm-6`, `arm-7`, `arm64`, `mips`, `mipsle`, `mips64`, `mips64le` * Achitectures: `386`, `amd64`, `arm-5`, `arm-6`, `arm-7`, `arm64`, `mips`, `mipsle`, `mips64`, `mips64le`
### Platform versions ### Platform versions
@ -207,7 +199,6 @@ selection of specific platform versions by appending them to the OS target strin
The supported platforms are: The supported platforms are:
* All Android APIs up to Android Lollipop 5.0 ([API level ids](https://source.android.com/source/build-numbers.html))
* All Windows APIs up to Windows 8.1 limited by `mingw-w64` ([API level ids](https://en.wikipedia.org/wiki/Windows_NT#Releases)) * All Windows APIs up to Windows 8.1 limited by `mingw-w64` ([API level ids](https://en.wikipedia.org/wiki/Windows_NT#Releases))
* OSX APIs in the range of 10.6 - 10.14 * OSX APIs in the range of 10.6 - 10.14

3
vendor/src.techknowlogick.com/xgo/go.mod generated vendored Normal file
View File

@ -0,0 +1,3 @@
module src.techknowlogick.com/xgo
go 1.12

View File

@ -18,6 +18,7 @@ import (
"os/exec" "os/exec"
"os/user" "os/user"
"path/filepath" "path/filepath"
"regexp"
"strconv" "strconv"
"strings" "strings"
) )
@ -31,8 +32,8 @@ func init() {
depsCache = filepath.Join(home, ".xgo-cache") depsCache = filepath.Join(home, ".xgo-cache")
return return
} }
if user, err := user.Current(); user != nil && err == nil && user.HomeDir != "" { if usr, err := user.Current(); usr != nil && err == nil && usr.HomeDir != "" {
depsCache = filepath.Join(user.HomeDir, ".xgo-cache") depsCache = filepath.Join(usr.HomeDir, ".xgo-cache")
return return
} }
depsCache = filepath.Join(os.TempDir(), "xgo-cache") depsCache = filepath.Join(os.TempDir(), "xgo-cache")
@ -70,22 +71,24 @@ type ConfigFlags struct {
// Command line arguments to pass to go build // Command line arguments to pass to go build
var ( var (
buildVerbose = flag.Bool("v", false, "Print the names of packages as they are compiled") buildVerbose = flag.Bool("v", false, "Print the names of packages as they are compiled")
buildSteps = flag.Bool("x", false, "Print the command as executing the builds") buildSteps = flag.Bool("x", false, "Print the command as executing the builds")
buildRace = flag.Bool("race", false, "Enable data race detection (supported only on amd64)") buildRace = flag.Bool("race", false, "Enable data race detection (supported only on amd64)")
buildTags = flag.String("tags", "", "List of build tags to consider satisfied during the build") buildTags = flag.String("tags", "", "List of build tags to consider satisfied during the build")
buildLdFlags = flag.String("ldflags", "", "Arguments to pass on each go tool link invocation") buildLdFlags = flag.String("ldflags", "", "Arguments to pass on each go tool link invocation")
buildMode = flag.String("buildmode", "default", "Indicates which kind of object file to build") buildMode = flag.String("buildmode", "default", "Indicates which kind of object file to build")
buildTrimpath = flag.Bool("trimpath", false, "Indicates if trimpath should be applied to build")
) )
// BuildFlags is a simple collection of flags to fine tune a build. // BuildFlags is a simple collection of flags to fine tune a build.
type BuildFlags struct { type BuildFlags struct {
Verbose bool // Print the names of packages as they are compiled Verbose bool // Print the names of packages as they are compiled
Steps bool // Print the command as executing the builds Steps bool // Print the command as executing the builds
Race bool // Enable data race detection (supported only on amd64) Race bool // Enable data race detection (supported only on amd64)
Tags string // List of build tags to consider satisfied during the build Tags string // List of build tags to consider satisfied during the build
LdFlags string // Arguments to pass on each go tool link invocation LdFlags string // Arguments to pass on each go tool link invocation
Mode string // Indicates which kind of object file to build Mode string // Indicates which kind of object file to build
Trimpath bool // Indicates if trimpath should be applied to build
} }
func main() { func main() {
@ -174,12 +177,13 @@ func main() {
Targets: strings.Split(*targets, ","), Targets: strings.Split(*targets, ","),
} }
flags := &BuildFlags{ flags := &BuildFlags{
Verbose: *buildVerbose, Verbose: *buildVerbose,
Steps: *buildSteps, Steps: *buildSteps,
Race: *buildRace, Race: *buildRace,
Tags: *buildTags, Tags: *buildTags,
LdFlags: *buildLdFlags, LdFlags: *buildLdFlags,
Mode: *buildMode, Mode: *buildMode,
Trimpath: *buildTrimpath,
} }
folder, err := os.Getwd() folder, err := os.Getwd()
if err != nil { if err != nil {
@ -219,7 +223,23 @@ func checkDockerImage(image string) (bool, error) {
if err != nil { if err != nil {
return false, err return false, err
} }
return compareOutAndImage(out, image)
}
// compare output of docker images and image name
func compareOutAndImage(out []byte, image string) (bool, error) {
if strings.Contains(image, ":") {
// get repository and tag
res := strings.SplitN(image, ":", 2)
r, t := res[0], res[1]
match, _ := regexp.Match(fmt.Sprintf(`%s\s+%s`, r, t), out)
return match, nil
}
// default find repository without tag
return bytes.Contains(out, []byte(image)), nil return bytes.Contains(out, []byte(image)), nil
} }
// Pulls an image from the docker registry. // Pulls an image from the docker registry.
@ -290,10 +310,16 @@ func compile(image string, config *ConfigFlags, flags *BuildFlags, folder string
// Assemble and run the cross compilation command // Assemble and run the cross compilation command
fmt.Printf("Cross compiling %s...\n", config.Repository) fmt.Printf("Cross compiling %s...\n", config.Repository)
// Alter paths so they work for Windows
// Does not affect Linux paths
re := regexp.MustCompile("([A-Z]):")
folder_w := filepath.ToSlash(re.ReplaceAllString(folder, "/$1"))
depsCache_w := filepath.ToSlash(re.ReplaceAllString(depsCache, "/$1"))
args := []string{ args := []string{
"run", "--rm", "run", "--rm",
"-v", folder + ":/build", "-v", folder_w + ":/build",
"-v", depsCache + ":/deps-cache:ro", "-v", depsCache_w + ":/deps-cache:ro",
"-e", "REPO_REMOTE=" + config.Remote, "-e", "REPO_REMOTE=" + config.Remote,
"-e", "REPO_BRANCH=" + config.Branch, "-e", "REPO_BRANCH=" + config.Branch,
"-e", "PACK=" + config.Package, "-e", "PACK=" + config.Package,
@ -306,7 +332,9 @@ func compile(image string, config *ConfigFlags, flags *BuildFlags, folder string
"-e", fmt.Sprintf("FLAG_TAGS=%s", flags.Tags), "-e", fmt.Sprintf("FLAG_TAGS=%s", flags.Tags),
"-e", fmt.Sprintf("FLAG_LDFLAGS=%s", flags.LdFlags), "-e", fmt.Sprintf("FLAG_LDFLAGS=%s", flags.LdFlags),
"-e", fmt.Sprintf("FLAG_BUILDMODE=%s", flags.Mode), "-e", fmt.Sprintf("FLAG_BUILDMODE=%s", flags.Mode),
"-e", fmt.Sprintf("FLAG_TRIMPATH=%v", flags.Trimpath),
"-e", "TARGETS=" + strings.Replace(strings.Join(config.Targets, " "), "*", ".", -1), "-e", "TARGETS=" + strings.Replace(strings.Join(config.Targets, " "), "*", ".", -1),
"-e", fmt.Sprintf("GOPROXY=%s", os.Getenv("GOPROXY")),
} }
if usesModules { if usesModules {
args = append(args, []string{"-e", "GO111MODULE=on"}...) args = append(args, []string{"-e", "GO111MODULE=on"}...)
@ -363,6 +391,7 @@ func compileContained(config *ConfigFlags, flags *BuildFlags, folder string) err
fmt.Sprintf("FLAG_TAGS=%s", flags.Tags), fmt.Sprintf("FLAG_TAGS=%s", flags.Tags),
fmt.Sprintf("FLAG_LDFLAGS=%s", flags.LdFlags), fmt.Sprintf("FLAG_LDFLAGS=%s", flags.LdFlags),
fmt.Sprintf("FLAG_BUILDMODE=%s", flags.Mode), fmt.Sprintf("FLAG_BUILDMODE=%s", flags.Mode),
fmt.Sprintf("FLAG_TRIMPATH=%v", flags.Trimpath),
"TARGETS=" + strings.Replace(strings.Join(config.Targets, " "), "*", ".", -1), "TARGETS=" + strings.Replace(strings.Join(config.Targets, " "), "*", ".", -1),
} }
if local { if local {