diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 070e90a..82eccd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ jobs: fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: 1.17 + go-version: 1.22 - uses: actions/cache@v2 with: diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index e3c994a..700189c 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -13,17 +13,17 @@ jobs: environment: staging runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - id: "auth" - uses: "google-github-actions/auth@v0" + uses: "google-github-actions/auth@v2" with: credentials_json: "${{ secrets.GCP_SA_CREDS_JSON }}" # Workaround to support Gen2 Cloud Functions # https://github.com/google-github-actions/deploy-cloud-functions/issues/304 - name: "Set up Cloud SDK" - uses: "google-github-actions/setup-gcloud@v0" + uses: "google-github-actions/setup-gcloud@v2" - id: "deploy" run: > @@ -34,7 +34,7 @@ jobs: --gen2 --region=us-central1 --source=. - --runtime=go118 + --runtime=go122 --trigger-http --allow-unauthenticated --entry-point=ServeShorty diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f024036..829d1d3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,17 +12,17 @@ jobs: environment: production runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - id: "auth" - uses: "google-github-actions/auth@v0" + uses: "google-github-actions/auth@v2" with: credentials_json: "${{ secrets.GCP_SA_CREDS_JSON }}" # Workaround to support Gen2 Cloud Functions # https://github.com/google-github-actions/deploy-cloud-functions/issues/304 - name: "Set up Cloud SDK" - uses: "google-github-actions/setup-gcloud@v0" + uses: "google-github-actions/setup-gcloud@v2" - id: "deploy" run: > @@ -33,7 +33,7 @@ jobs: --gen2 --region=us-central1 --source=. - --runtime=go118 + --runtime=go122 --trigger-http --allow-unauthenticated --entry-point=ServeShorty diff --git a/README.md b/README.md index 5683740..7e600ac 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # **URL Shortening Service (Go)** -![Coverage](https://img.shields.io/badge/Coverage-55.7%25-yellow) +![Coverage](https://img.shields.io/badge/Coverage-54.6%25-yellow) Create short URLs, resolve shortened URLs, and fetch all shortened URLs. diff --git a/function.go b/function.go index 143dc26..153c036 100644 --- a/function.go +++ b/function.go @@ -42,7 +42,7 @@ func NewApp() *http.ServeMux { errorClient.Report(errorreporting.Entry{ Error: fmt.Errorf("initStore: %v", err), }) - log.Fatal("Could not start") + log.Fatalf("Could not start: %v", err) } baseURL := os.Getenv("HOST_BASE_URL") diff --git a/go.mod b/go.mod index 047199d..4080f33 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/operationspark/shorty -go 1.19 +go 1.22 require ( cloud.google.com/go/errorreporting v0.2.0 diff --git a/go.sum b/go.sum index c9ed2ac..53292fe 100644 --- a/go.sum +++ b/go.sum @@ -120,6 +120,7 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -228,6 +229,7 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2 h1:hRGSmZu7j271trc9sneMrpOW7GN5ngLm8YUZIPzf394= +github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= @@ -728,6 +730,7 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I= +gotest.tools/v3 v3.2.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/my-coverfile.txt b/my-coverfile.txt new file mode 100644 index 0000000..3374df7 --- /dev/null +++ b/my-coverfile.txt @@ -0,0 +1,12 @@ +mode: atomic +github.com/operationspark/shorty/function.go:14.13,19.2 1 1 +github.com/operationspark/shorty/function.go:23.30,25.16 2 1 +github.com/operationspark/shorty/function.go:29.2,29.31 1 1 +github.com/operationspark/shorty/function.go:25.16,26.13 1 0 +github.com/operationspark/shorty/function.go:33.46,34.31 1 1 +github.com/operationspark/shorty/function.go:37.2,38.24 2 1 +github.com/operationspark/shorty/function.go:42.2,43.16 2 1 +github.com/operationspark/shorty/function.go:46.2,46.19 1 1 +github.com/operationspark/shorty/function.go:34.31,36.3 1 0 +github.com/operationspark/shorty/function.go:38.24,40.3 1 1 +github.com/operationspark/shorty/function.go:43.16,45.3 1 0