Skip to content

Commit

Permalink
upgrade golang to 1.22
Browse files Browse the repository at this point in the history
  • Loading branch information
jkralik committed May 10, 2024
1 parent ed9e661 commit f960580
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-with-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version || '^1.20' }}
go-version: ${{ inputs.go-version || '^1.22' }}
check-latest: true

- run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
matrix:
include:
# test build of oldest supported go version
- name: go1.20
go-version: "~1.20"
- name: go1.22
go-version: "~1.22"
uses: ./.github/workflows/build-with-cfg.yml
with:
go-version: ${{ matrix.go-version }}
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go 1.20+
- name: Set up Go 1.22+
uses: actions/setup-go@v5
with:
go-version: "^1.20" # The Go version to download (if necessary) and use.
go-version: "^1.22" # The Go version to download (if necessary) and use.
check-latest: true
cache: false

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-with-cfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
- name: Shallow checkout
uses: actions/checkout@v4

- name: Set up Go 1.20+
- name: Set up Go 1.22+
uses: actions/setup-go@v5
with:
go-version: "^1.20"
go-version: "^1.22"
check-latest: true

- run: go version
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ issues:
# fix: true

run:
go: "1.20"
go: "1.22"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The **client** enables interaction with devices in a local network:

## Requirements

- Go 1.20 or higher
- Go 1.22 or higher

## Installation OCF Client

Expand Down
10 changes: 6 additions & 4 deletions bridge/resources/thingDescription/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"testing"
"time"

v2json "github.com/go-json-experiment/json"
"github.com/google/uuid"
bridgeDeviceTD "github.com/plgd-dev/device/v2/bridge/device/thingDescription"
thingDescriptionResource "github.com/plgd-dev/device/v2/bridge/resources/thingDescription"
Expand Down Expand Up @@ -77,10 +78,10 @@ func (JSONCodec) Decode(m *pool.Message, v interface{}) error {
func getThingDescription(t *testing.T, data interface{}) wotTD.ThingDescription {
tdMap, ok := data.(map[interface{}]interface{})
require.True(t, ok)
jsonData, err := json.Encode(tdMap)
jsonData, err := v2json.Marshal(tdMap)
require.NoError(t, err)
td := wotTD.ThingDescription{}
err = json.Decode(jsonData, &td)
err = v2json.Unmarshal(jsonData, &td)
require.NoError(t, err)
return td
}
Expand Down Expand Up @@ -246,8 +247,9 @@ func TestObserveThingDescription(t *testing.T) {
id, err := bridgeDeviceTD.GetThingDescriptionID(deviceID.String())
require.NoError(t, err)
td2 := wotTD.ThingDescription{
Base: *base,
ID: id,
Base: *base,
ID: id,
SecurityDefinitions: map[string]wotTD.SecurityScheme{},
}
d.GetThingDescriptionManager().NotifySubscriptions(td2)
n, err = h.WaitForNotification(ctx)
Expand Down
2 changes: 1 addition & 1 deletion cmd/bridge-device/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM golang:1.20.14-alpine AS build
FROM golang:1.22.3-alpine AS build
RUN apk add --no-cache curl git build-base
WORKDIR $GOPATH/src/github.com/plgd-dev/device
COPY go.mod go.sum ./
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/plgd-dev/device/v2

go 1.21
go 1.22

toolchain go1.22.0

Expand Down
2 changes: 1 addition & 1 deletion test/cloud-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20.14-alpine AS build
FROM golang:1.22.3-alpine AS build
RUN apk add --no-cache curl git build-base
WORKDIR $GOPATH/src/github.com/plgd-dev/device
COPY go.mod go.sum ./
Expand Down

0 comments on commit f960580

Please sign in to comment.