v0.0.19
This commit is contained in:
parent
b643bded8a
commit
b35d6ca0b0
3
Makefile
3
Makefile
@ -4,3 +4,6 @@ run:
|
|||||||
|
|
||||||
test:
|
test:
|
||||||
go test ./...
|
go test ./...
|
||||||
|
|
||||||
|
version:
|
||||||
|
_data/version.sh
|
27
_data/version.sh
Executable file
27
_data/version.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -o nounset # disallow usage of unset vars ( set -u )
|
||||||
|
set -o errexit # Exit immediately if a pipeline returns non-zero. ( set -e )
|
||||||
|
set -o errtrace # Allow the above trap be inherited by all functions in the script. ( set -E )
|
||||||
|
set -o pipefail # Return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status
|
||||||
|
IFS=$'\n\t' # Set $IFS to only newline and tab.
|
||||||
|
|
||||||
|
|
||||||
|
curr_vers=$(git describe --tags --abbrev=0 | sed 's/v//g')
|
||||||
|
|
||||||
|
next_ver=$(echo "$curr_vers" | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}')
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "> Current Version: ${curr_vers}"
|
||||||
|
echo "> Next Version: ${next_ver}"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
git add --verbose .
|
||||||
|
|
||||||
|
git commit -a -m "v${next_ver}"
|
||||||
|
|
||||||
|
git tag "v${next_ver}"
|
||||||
|
|
||||||
|
git push
|
||||||
|
git push --tags
|
||||||
|
|
@ -29,3 +29,21 @@ func Min[T langext.OrderedConstraint](v1 T, v2 T) T {
|
|||||||
return v2
|
return v2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Abs[T langext.NumberConstraint](v T) T {
|
||||||
|
if v < 0 {
|
||||||
|
return -v
|
||||||
|
} else {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Clamp[T langext.NumberConstraint](v T, min T, max T) T {
|
||||||
|
if v < min {
|
||||||
|
return min
|
||||||
|
} else if v > max {
|
||||||
|
return max
|
||||||
|
} else {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user