From 9d82371c5884966939a1e3f6a61e46d5f2869478 Mon Sep 17 00:00:00 2001 From: Amir Omidi Date: Sun, 19 Nov 2023 21:07:43 -0500 Subject: [PATCH 1/4] Add go modules and go workspace --- .github/workflows/test.yml | 2 +- .github/workflows/tld-update.yml | 2 +- go.work | 3 +++ newgtlds/go.mod | 3 +++ {tools => newgtlds}/newgtlds.go | 0 {tools => newgtlds}/newgtlds_test.go | 0 tools/patchnewgtlds | 2 +- 7 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 go.work create mode 100644 newgtlds/go.mod rename {tools => newgtlds}/newgtlds.go (100%) rename {tools => newgtlds}/newgtlds_test.go (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b91d153c1..44cd4de56 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: go-version: 'stable' - name: Run Go unit tests - run: go test tools/*.go + run: go test ./newgtlds - name: Install dependencies run: sudo apt install -y autopoint diff --git a/.github/workflows/tld-update.yml b/.github/workflows/tld-update.yml index d5e8621e6..84d0d2224 100644 --- a/.github/workflows/tld-update.yml +++ b/.github/workflows/tld-update.yml @@ -26,7 +26,7 @@ jobs: go-version: 'stable' - name: Run unit tests - run: go test tools/*.go + run: go test ./newgtlds - name: Set current date id: get-date diff --git a/go.work b/go.work new file mode 100644 index 000000000..daa798a45 --- /dev/null +++ b/go.work @@ -0,0 +1,3 @@ +go 1.21.4 + +use ./newgtlds diff --git a/newgtlds/go.mod b/newgtlds/go.mod new file mode 100644 index 000000000..749371d91 --- /dev/null +++ b/newgtlds/go.mod @@ -0,0 +1,3 @@ +module github.com/publicsuffix/list/newgtlds + +go 1.21.4 diff --git a/tools/newgtlds.go b/newgtlds/newgtlds.go similarity index 100% rename from tools/newgtlds.go rename to newgtlds/newgtlds.go diff --git a/tools/newgtlds_test.go b/newgtlds/newgtlds_test.go similarity index 100% rename from tools/newgtlds_test.go rename to newgtlds/newgtlds_test.go diff --git a/tools/patchnewgtlds b/tools/patchnewgtlds index ddc93a900..74bbd1eb7 100755 --- a/tools/patchnewgtlds +++ b/tools/patchnewgtlds @@ -11,6 +11,6 @@ fi BASEDIR=$(dirname "$0") -go run "$BASEDIR/newgtlds.go" \ +go run "$BASEDIR/../newgtlds" \ -overwrite \ -psl-dat-file="$BASEDIR/../public_suffix_list.dat" From c72320d6e57165bd05f91d7b4a93592a1b21aae4 Mon Sep 17 00:00:00 2001 From: Amir Omidi Date: Sun, 19 Nov 2023 21:28:47 -0500 Subject: [PATCH 2/4] Stop using go.work. --- .github/workflows/test.yml | 2 +- .github/workflows/tld-update.yml | 2 +- go.work | 3 --- tools/patchnewgtlds | 6 ++++-- 4 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 go.work diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 44cd4de56..8ff006bad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: go-version: 'stable' - name: Run Go unit tests - run: go test ./newgtlds + run: go test -C ./newgtlds . - name: Install dependencies run: sudo apt install -y autopoint diff --git a/.github/workflows/tld-update.yml b/.github/workflows/tld-update.yml index 84d0d2224..bdbae8894 100644 --- a/.github/workflows/tld-update.yml +++ b/.github/workflows/tld-update.yml @@ -26,7 +26,7 @@ jobs: go-version: 'stable' - name: Run unit tests - run: go test ./newgtlds + run: go test -C ./newgtlds . - name: Set current date id: get-date diff --git a/go.work b/go.work deleted file mode 100644 index daa798a45..000000000 --- a/go.work +++ /dev/null @@ -1,3 +0,0 @@ -go 1.21.4 - -use ./newgtlds diff --git a/tools/patchnewgtlds b/tools/patchnewgtlds index 74bbd1eb7..db8937808 100755 --- a/tools/patchnewgtlds +++ b/tools/patchnewgtlds @@ -2,6 +2,7 @@ set -e set -o pipefail +set -x if ! [ -x "$(command -v go)" ] then @@ -9,8 +10,9 @@ then exit 1 fi -BASEDIR=$(dirname "$0") +SCRIPT=$(realpath "$0") +BASEDIR=$(dirname "$SCRIPT") -go run "$BASEDIR/../newgtlds" \ +go run -C "$BASEDIR/../newgtlds" . \ -overwrite \ -psl-dat-file="$BASEDIR/../public_suffix_list.dat" From 3e63ddf9b59913b8d588f39406e9e2c029de49a1 Mon Sep 17 00:00:00 2001 From: Amir Omidi Date: Tue, 21 Nov 2023 11:46:17 -0500 Subject: [PATCH 3/4] Move newgtlds back onto `tools` --- .github/workflows/test.yml | 2 +- .github/workflows/tld-update.yml | 6 +++--- newgtlds/go.mod | 3 --- tools/go.mod | 3 +++ {newgtlds => tools}/newgtlds.go | 0 {newgtlds => tools}/newgtlds_test.go | 0 tools/patchnewgtlds | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 newgtlds/go.mod create mode 100644 tools/go.mod rename {newgtlds => tools}/newgtlds.go (100%) rename {newgtlds => tools}/newgtlds_test.go (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ff006bad..edcfce20c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: go-version: 'stable' - name: Run Go unit tests - run: go test -C ./newgtlds . + run: go test -C ./tools . - name: Install dependencies run: sudo apt install -y autopoint diff --git a/.github/workflows/tld-update.yml b/.github/workflows/tld-update.yml index bdbae8894..eb21c4f73 100644 --- a/.github/workflows/tld-update.yml +++ b/.github/workflows/tld-update.yml @@ -4,7 +4,7 @@ on: schedule: # Run once a day at 15:00 UTC - cron: '0 15 * * *' - + permissions: contents: read @@ -26,7 +26,7 @@ jobs: go-version: 'stable' - name: Run unit tests - run: go test -C ./newgtlds . + run: go test -C ./tools . - name: Set current date id: get-date @@ -49,7 +49,7 @@ jobs: ✅ autopull 🚩ICANN (IANA/ICP-3) Section delete-branch: true - + - name: Check outputs run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" diff --git a/newgtlds/go.mod b/newgtlds/go.mod deleted file mode 100644 index 749371d91..000000000 --- a/newgtlds/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/publicsuffix/list/newgtlds - -go 1.21.4 diff --git a/tools/go.mod b/tools/go.mod new file mode 100644 index 000000000..b1bb1e50b --- /dev/null +++ b/tools/go.mod @@ -0,0 +1,3 @@ +module github.com/publicsuffix/list/tools + +go 1.21.4 diff --git a/newgtlds/newgtlds.go b/tools/newgtlds.go similarity index 100% rename from newgtlds/newgtlds.go rename to tools/newgtlds.go diff --git a/newgtlds/newgtlds_test.go b/tools/newgtlds_test.go similarity index 100% rename from newgtlds/newgtlds_test.go rename to tools/newgtlds_test.go diff --git a/tools/patchnewgtlds b/tools/patchnewgtlds index db8937808..8a1d39d43 100755 --- a/tools/patchnewgtlds +++ b/tools/patchnewgtlds @@ -13,6 +13,6 @@ fi SCRIPT=$(realpath "$0") BASEDIR=$(dirname "$SCRIPT") -go run -C "$BASEDIR/../newgtlds" . \ +go run -C "$BASEDIR/" . \ -overwrite \ -psl-dat-file="$BASEDIR/../public_suffix_list.dat" From d830e6d036a05a349837515b0a97a672984ad941 Mon Sep 17 00:00:00 2001 From: Amir Omidi Date: Fri, 24 Nov 2023 20:12:36 -0500 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Daniel McCarney --- .github/workflows/tld-update.yml | 2 +- tools/go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tld-update.yml b/.github/workflows/tld-update.yml index eb21c4f73..e347769c4 100644 --- a/.github/workflows/tld-update.yml +++ b/.github/workflows/tld-update.yml @@ -26,7 +26,7 @@ jobs: go-version: 'stable' - name: Run unit tests - run: go test -C ./tools . + run: go test -v -C ./tools . - name: Set current date id: get-date diff --git a/tools/go.mod b/tools/go.mod index b1bb1e50b..92ebf13d8 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -1,3 +1,3 @@ module github.com/publicsuffix/list/tools -go 1.21.4 +go 1.21