Skip to content

Commit

Permalink
Merge pull request #243 from GeoNet/go1.21
Browse files Browse the repository at this point in the history
Go1.21
  • Loading branch information
sue-h-gns authored Jan 24, 2024
2 parents efe34a0 + 8a6a6f8 commit b2d21dd
Show file tree
Hide file tree
Showing 55 changed files with 83 additions and 612 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: GeoNet/yq@bbe305500687a5fe8498d74883c17f0f06431ac4 # master
- id: git-rev
env:
GIT_SHA: ${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.tmplate
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILDER_IMAGE=ghcr.io/geonet/base-images/go:1.16
ARG BUILDER_IMAGE=ghcr.io/geonet/base-images/go:1.21
ARG RUNNER_IMAGE=ghcr.io/geonet/base-images/static:latest
ARG RUN_USER=nobody
# Only support image based on AlpineLinux
Expand Down
2 changes: 1 addition & 1 deletion cmd/fdsn-quake-consumer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILDER_IMAGE=ghcr.io/geonet/base-images/go:1.16
ARG BUILDER_IMAGE=ghcr.io/geonet/base-images/go:1.21

FROM ${BUILDER_IMAGE} as builder
# Obtain ca-cert and tzdata, which we will add to the container
Expand Down
9 changes: 5 additions & 4 deletions cmd/fdsn-quake-consumer/sc3ml_backload_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
//go:build backload
// +build backload

package main

import (
"database/sql"
"github.com/GeoNet/kit/cfg"
"io/ioutil"
"log"
"os"
"strings"
"sync"
"testing"

"github.com/GeoNet/kit/cfg"
)

// TestBackload can be used to load SC3ML into the FDSN database. Files are read
Expand All @@ -37,7 +38,7 @@ func TestBackload(t *testing.T) {

var dir = "/work/seiscompml07-to-load"

files, err := ioutil.ReadDir(dir)
files, err := os.ReadDir(dir)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -70,7 +71,7 @@ func TestBackload(t *testing.T) {
defer wg.Done()

for f = range in {
b, err = ioutil.ReadFile(f)
b, err = os.ReadFile(f)
if err != nil {
log.Println(err)
continue
Expand Down
12 changes: 6 additions & 6 deletions cmd/fdsn-quake-consumer/sc3ml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"bytes"
"database/sql"
"io/ioutil"
"io"
"os"
"reflect"
"runtime"
Expand All @@ -17,7 +17,7 @@ var versions = []string{"2015p768477_0.7.xml", "2015p768477_0.8.xml", "2015p7684

func TestEventUnmarshal(t *testing.T) {
for _, input := range versions {
b, err := ioutil.ReadFile("etc/" + input)
b, err := os.ReadFile("etc/" + input)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestEventType(t *testing.T) {
// input test file is sc3ml 0.7 change the version string below to test each
// sc3ml version that is supported.
for _, input := range versions {
b, err := ioutil.ReadFile("etc/" + input)
b, err := os.ReadFile("etc/" + input)
if err != nil {
t.Fatal(err)
}
Expand All @@ -119,7 +119,7 @@ func TestEventType(t *testing.T) {

func TestToQuakeMLEvent(t *testing.T) {
for _, input := range versions {
b, err := ioutil.ReadFile("etc/" + input)
b, err := os.ReadFile("etc/" + input)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestToQuakeMLEvent(t *testing.T) {
}
defer f.Close()

if b, err = ioutil.ReadAll(f); err != nil {
if b, err = io.ReadAll(f); err != nil {
t.Fatal(err)
}

Expand All @@ -173,7 +173,7 @@ func TestEventSave(t *testing.T) {
}
defer f.Close()

if b, err = ioutil.ReadAll(f); err != nil {
if b, err = io.ReadAll(f); err != nil {
t.Fatal(err)
}

Expand Down
12 changes: 6 additions & 6 deletions cmd/fdsn-ws-nrt/fdsn_dataselect.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import (
"bytes"
"context"
"fmt"
"github.com/GeoNet/fdsn/internal/fdsn"
"github.com/GeoNet/kit/metrics"
"github.com/GeoNet/kit/weft"
"github.com/golang/groupcache"
"io/ioutil"
"log"
"net/http"
"os"
"regexp"
"text/template"
"time"

"github.com/GeoNet/fdsn/internal/fdsn"
"github.com/GeoNet/kit/metrics"
"github.com/GeoNet/kit/weft"
"github.com/golang/groupcache"
)

const NO_DATA = 204
Expand All @@ -38,7 +38,7 @@ func init() {
}
fdsnDataselectWadlFile = b.Bytes()

fdsnDataselectIndex, err = ioutil.ReadFile("assets/fdsn-ws-dataselect.html")
fdsnDataselectIndex, err = os.ReadFile("assets/fdsn-ws-dataselect.html")
if err != nil {
log.Printf("error reading assets/fdsn-ws-dataselect.html: %s", err.Error())
}
Expand Down
7 changes: 4 additions & 3 deletions cmd/fdsn-ws-nrt/routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package main

import (
"database/sql"
wt "github.com/GeoNet/kit/weft/wefttest"
"io/ioutil"
"io"
"log"
"net/http"
"net/http/httptest"
"testing"

wt "github.com/GeoNet/kit/weft/wefttest"
)

var testServer *httptest.Server
Expand Down Expand Up @@ -77,7 +78,7 @@ func setup(t *testing.T) {
// Silence the logging unless running with
// go test -v
if !testing.Verbose() {
log.SetOutput(ioutil.Discard)
log.SetOutput(io.Discard)
}
}

Expand Down
3 changes: 1 addition & 2 deletions cmd/fdsn-ws/fdsn_dataselect.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -61,7 +60,7 @@ func init() {
}
fdsnDataselectWadlFile = b.Bytes()

fdsnDataselectIndex, err = ioutil.ReadFile("assets/fdsn-ws-dataselect.html")
fdsnDataselectIndex, err = os.ReadFile("assets/fdsn-ws-dataselect.html")
if err != nil {
log.Printf("error reading assets/fdsn-ws-dataselect.html: %s", err.Error())
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/fdsn-ws/fdsn_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"database/sql"
"errors"
"fmt"
"io/ioutil"
"log"
"math"
"net/http"
Expand Down Expand Up @@ -110,7 +109,7 @@ func init() {
}
fdsnEventWadlFile = b.Bytes()

fdsnEventIndex, err = ioutil.ReadFile("assets/fdsn-ws-event.html")
fdsnEventIndex, err = os.ReadFile("assets/fdsn-ws-event.html")
if err != nil {
log.Printf("error reading assets/fdsn-ws-event.html: %s", err.Error())
}
Expand All @@ -119,9 +118,10 @@ func init() {
/*
parses the time in text as per the FDSN spec. Pads text for parsing with
time.RFC3339Nano. Accepted formats are (UTC):
YYYY-MM-DDTHH:MM:SS.ssssss
YYYY-MM-DDTHH:MM:SS
YYYY-MM-DD
YYYY-MM-DDTHH:MM:SS.ssssss
YYYY-MM-DDTHH:MM:SS
YYYY-MM-DD
Implements the encoding.TextUnmarshaler interface.
*/
Expand Down
5 changes: 2 additions & 3 deletions cmd/fdsn-ws/fdsn_station.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"math"
"net/http"
Expand Down Expand Up @@ -127,7 +126,7 @@ func init() {
}
fdsnStationWadlFile = b.Bytes()

fdsnStationIndex, err = ioutil.ReadFile("assets/fdsn-ws-station.html")
fdsnStationIndex, err = os.ReadFile("assets/fdsn-ws-station.html")
if err != nil {
log.Printf("error reading assets/fdsn-ws-station.html: %s", err.Error())
}
Expand Down Expand Up @@ -482,7 +481,7 @@ func fdsnStationV1Handler(r *http.Request, h http.Header, b *bytes.Buffer) error
}
params = []fdsnStationV1Search{p}
case "POST":
body, err := ioutil.ReadAll(r.Body)
body, err := io.ReadAll(r.Body)
if err != nil {
return fdsnError{StatusError: weft.StatusError{Code: http.StatusBadRequest, Err: err}, timestamp: tm, url: r.URL.String()}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/fdsn-ws/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"database/sql"
"io/ioutil"
"io"
"log"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -68,7 +68,7 @@ func setup(t *testing.T) {
// Silence the logging unless running with
// go test -v
if !testing.Verbose() {
log.SetOutput(ioutil.Discard)
log.SetOutput(io.Discard)
}
}

Expand Down
27 changes: 26 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
module github.com/GeoNet/fdsn

go 1.16
go 1.21

require (
github.com/GeoNet/kit v0.0.0-20220629232654-4b4c51b3443f
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
github.com/gorilla/schema v1.2.0
github.com/lib/pq v1.10.3
)

require (
github.com/aws/aws-sdk-go-v2 v1.16.2 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.1 // indirect
github.com/aws/aws-sdk-go-v2/config v1.15.3 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.3 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.3 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.3 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.26.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.11.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.16.3 // indirect
github.com/aws/smithy-go v1.11.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
Expand Down

This file was deleted.

This file was deleted.

32 changes: 0 additions & 32 deletions vendor/github.com/aws/aws-sdk-go-v2/config/go.mod

This file was deleted.

13 changes: 0 additions & 13 deletions vendor/github.com/aws/aws-sdk-go-v2/config/go.sum

This file was deleted.

Loading

0 comments on commit b2d21dd

Please sign in to comment.