-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,068 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e # Exit on any error | ||
|
||
fail() { | ||
echo "Error: $1" >&2 | ||
exit 1 | ||
} | ||
|
||
# Get GOROOT using `go env` | ||
GOROOT=$(go env GOROOT) | ||
if [ $? -ne 0 ]; then | ||
fail "Failed to get GOROOT" | ||
fi | ||
|
||
# Get the path to the zoneinfo.zip | ||
ZIPNAME="$GOROOT/lib/time/zoneinfo.zip" | ||
if [ ! -f "$ZIPNAME" ]; then | ||
fail "zoneinfo.zip not found at $ZIPNAME" | ||
fi | ||
|
||
# Open the output file | ||
GOFILE=${GOFILE:-"timezones.go"} | ||
GOFILE="$(basename "$GOFILE" ".go")_generated.go" | ||
if ! touch "$GOFILE"; then | ||
fail "Failed to create output file $GOFILE" | ||
fi | ||
|
||
# Write the generated code header | ||
{ | ||
echo "// Code generated by \"$(basename "${BASH_SOURCE[0]}")\"" | ||
echo "" | ||
echo "package ${GOPACKAGE:-main}" | ||
echo "" | ||
echo "var TimeZones = []string{" | ||
} > "$GOFILE" | ||
|
||
# List the contents of the zip file and append them to the output file | ||
if ! unzip -Z1 "$ZIPNAME" | while read -r path; do | ||
echo " \"${path//Etc\//}\"," >> "$GOFILE" | ||
done; then | ||
fail "Failed to process zip file $ZIPNAME" | ||
fi | ||
|
||
# Close the Go array | ||
echo "}" >> "$GOFILE" | ||
|
||
echo "TimeZones list generated successfully in $GOFILE." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,32 +48,23 @@ prereq:: | |
$(GOCMD) install github.com/jstemmer/[email protected] | ||
GOBIN=${TOOLS_DIR} $(GOCMD) install go.uber.org/mock/[email protected] | ||
|
||
build:: | ||
go env GOOS GOARCH | ||
go build -ldflags="${LINKERFLAGS}" -gcflags ${COMPILERFLAGS} -o ${BINARY_CLI}/worker-cli-plugin main.go | ||
|
||
|
||
build-install:: build | ||
mkdir -p "${HOME}/.jfrog/plugins/worker/bin" | ||
mv ${BINARY_CLI}/worker-cli-plugin "${HOME}/.jfrog/plugins/worker/bin/worker" | ||
chmod +x "${HOME}/.jfrog/plugins/worker/bin/worker" | ||
|
||
########## TEST ########## | ||
|
||
.PHONY: clean-mock | ||
clean-mock: | ||
@echo Cleaning generated mock files | ||
find . -path "*/mocks/*.go" -delete | ||
|
||
.PHONY: generate-mock | ||
generate-mock: clean-mock | ||
@echo Generating test mocks | ||
TOOLS_DIR=$(TOOLS_DIR) go generate ./... | ||
generate: prereq clean-mock | ||
TOOLS_DIR=$(TOOLS_DIR) SCRIPTS_DIR=$(SCRIPTS_DIR) go generate ./... | ||
|
||
# Used in pipeline so we keep this alias | ||
generate-mock: generate | ||
|
||
test-prereq: prereq generate-mock | ||
test-prereq: generate-mock | ||
mkdir -p target/reports | ||
|
||
test: PACKAGES=./... | ||
test: TAGS=-tags=test | ||
test: TEST_ARGS=-short | ||
test: test-prereq do-run-tests | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.