-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check go and nodejs version by go.mod and package.json, update Go official site URL #19197
Changes from 5 commits
8ba8f67
65e3d54
402d1c7
fe7b886
1d8fff7
d1d2df3
8e4ae0a
124ff3d
220b3cc
6cc8fe2
af61490
948516d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,12 @@ HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" ) | |
COMMA := , | ||
|
||
XGO_VERSION := go-1.18.x | ||
MIN_GO_VERSION := 001017000 | ||
MIN_NODE_VERSION := 012017000 | ||
|
||
MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2) | ||
MIN_GO_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' ')) | ||
|
||
MIN_NODE_VERSION_STR := $(shell grep -Eo '"node":.*[0-9.]+"' package.json | sed -n 's/.*[^0-9.]\([0-9.]*\)"/\1/p') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May as well extract the third version segment as well because node version is always 3-segments as opposed to go version which is 2. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It already has the 3-segments. The regex is |
||
MIN_NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_NODE_VERSION_STR)' | tr '.' ' ')) | ||
|
||
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.29.0 | ||
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.4.0 | ||
|
@@ -205,9 +209,10 @@ help: | |
go-check: | ||
$(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9.]+' | tr '.' ' ');)) | ||
@if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \ | ||
echo "Gitea requires Go 1.16 or greater to build. You can get it at https://golang.org/dl/"; \ | ||
echo "Gitea requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \ | ||
exit 1; \ | ||
fi | ||
@echo "checked whether go matches min version: $(MIN_GO_VERSION_STR)" | ||
|
||
.PHONY: git-check | ||
git-check: | ||
|
@@ -225,6 +230,7 @@ node-check: | |
echo "Gitea requires Node.js $(MIN_NODE_VER_FMT) or greater and npm to build. You can get it at https://nodejs.org/en/download/"; \ | ||
exit 1; \ | ||
fi | ||
@echo "checked nodejs matches min version: $(MIN_NODE_VERSION_STR)" | ||
|
||
.PHONY: clean-all | ||
clean-all: clean | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line above extracts 2 segments, but this seems to output 3. Is it correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already has the 3-segments. The regex is [0-9.]*