Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Version
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Utilities
Version
Commits
3838f031
Verified
Commit
3838f031
authored
1 year ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
fix: build process
parent
0f2c2d0c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/go-compile.sh
+52
-0
52 additions, 0 deletions
bin/go-compile.sh
with
52 additions
and
0 deletions
bin/go-compile.sh
0 → 100755
+
52
−
0
View file @
3838f031
#!/usr/bin/env bash
set
-x
SOURCE_PATH
=
$1
BUILD_PATH
=
$2
COMPONENT_SLUG
=
$3
GO_RELEASE_PACKAGE_NAME
=
$4
PROJECT_VERSION
=
$5
PROJECT_BUILD_DATE
=
$6
platforms
=
$(
go tool dist list
)
included_os
=(
"linux"
"windows"
)
# define a list of excluded architectures
included_arch
=(
"amd64"
"arm64"
)
cd
$SOURCE_PATH
||
exit
1
# Run and build loop through all platforms (except excluded ones)
for
platform
in
$platforms
;
do
# GOOS und GOARCH Variablen setzen
export
GOOS
=
$(
echo
$platform
|
cut
-d
'/'
-f1
)
export
GOARCH
=
$(
echo
$platform
|
cut
-d
'/'
-f2
)
if
[[
!
"
${
included_os
[@]
}
"
=
~
"
$GOOS
"
]]
;
then
echo
"Skipping excluded platform:
$GOOS
"
continue
fi
if
[[
!
"
${
included_arch
[@]
}
"
=
~
"
$GOARCH
"
]]
;
then
echo
"Skipping excluded architecture:
$GOARCH
"
continue
fi
echo
"============================================"
echo
"Building for
$GOOS
/
$GOARCH
"
output_name
=
$BUILD_PATH$COMPONENT_SLUG
-
$GOOS
-
$GOARCH
if
[
$GOOS
=
"windows"
]
;
then
output_name+
=
'.exe'
fi
env
GOFLAGS
=
GOWORK
=
off
GO111MODULE
=
on
GOOS
=
$GOOS
GOARCH
=
$GOARCH
go build
-ldflags
"-X
$GO_RELEASE_PACKAGE_NAME
.version=
$PROJECT_VERSION
-X
$GO_RELEASE_PACKAGE_NAME
.build=
$PROJECT_BUILD_DATE
"
-o
$output_name
if
[
$?
-ne
0
]
;
then
echo
"An error has occurred!
$output_name
build failed."
echo
"============================================"
fi
done
cd
-
||
exit
1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment