Skip to content

Commit

Permalink
Merge pull request #4 from jrapoport/update-go1.23
Browse files Browse the repository at this point in the history
Update to go1.23
  • Loading branch information
jrapoport authored Oct 20, 2024
2 parents a610f59 + b3ec0a0 commit 009a7c2
Show file tree
Hide file tree
Showing 23 changed files with 1,971 additions and 2,015 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.17.x]
go-version: [1.23.x]
runs-on: ubuntu-latest
steps:
- name: Install Go
Expand Down
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ GO_MOD := $(GO) mod
GO_GET := $(GO) get -u -v
GO_FMT := $(GO) fmt
GO_RUN := $(GO) run
GO_TEST:= $(GO) test -p 1 -v
GO_LINT := $(GO_BIN)/golint
GO_TEST:= $(GO) test -p 1 -v -failfast
GO_LINT := golangci-lint run
# BUG: go vet: structtag field repeats json warning with valid override #40102
# https://github.com/golang/go/issues/40102
GO_VET:= $(GO) vet -v -structtag=false

$(GO_LINT):
$(GO_GET) golang.org/x/lint/golint
#$(GO_LINT):
# $(GO_GET) golang.org/x/lint/golint
# brew install golangci-lint

deps:
$(GO_MOD) tidy
Expand All @@ -22,13 +23,14 @@ deps:
fmt:
$(GO_FMT) ./...

lint: $(GO_LINT)
lint:
$(GO_LINT) ./...

vet:
$(GO_VET) ./...

pr: lint vet
# disable lint for now
pr: vet

test:
$(GO_TEST) $(TEST_FLAGS) ./...
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Chestnut is a storage chest, and not a datastore itself. As such, Chestnut must
be backed by a storage solution.

Currently, Chestnut supports [BBolt](https://github.com/etcd-io/bbolt) and
[NutsDB](https://github.com/xujiajun/nutsdb) as backing storage.
[NutsDB](https://github.com/nutsdb/nutsdb) as backing storage.

## Table of Contents
- [Getting Started](#getting-started)
Expand Down Expand Up @@ -136,7 +136,7 @@ supports the`storage.Storage` interface.

Currently, Chestnut has built-in support for
[BBolt](https://github.com/etcd-io/bbolt) and
[NutsDB](https://github.com/xujiajun/nutsdb).
[NutsDB](https://github.com/nutsdb/nutsdb).

#### BBolt

Expand All @@ -159,9 +159,9 @@ cn := chestnut.NewChestnut(store, ...)

#### NutsDB

https://github.com/xujiajun/nutsdb
https://github.com/nutsdb/nutsdb
Chestnut has built-in support for using
[NutsDB](https://github.com/xujiajun/nutsdb) as a backing store.
[NutsDB](https://github.com/nutsdb/nutsdb) as a backing store.

To use nutsDB for a backing store you can import Chestnut's `nuts` package
and call `nuts.NewStore()`:
Expand Down Expand Up @@ -933,7 +933,7 @@ package main

import (
"github.com/ipfs/go-ipfs/keystore"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p/core/crypto"
)
```

Expand Down
10 changes: 5 additions & 5 deletions encoding/json/encoders/secure/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"github.com/json-iterator/go"
)

// SecureLookupPrefix will format the secure lookup token to "[prefix]-[encoder id]-[index]".
const SecureLookupPrefix = "cn"
// LookupPrefix will format the secure lookup token to "[prefix]-[encoder id]-[index]".
const LookupPrefix = "cn"

// EncryptionFunction defines the prototype for the encryption callback.
// See WARNING regarding use of PassthroughEncryption.
Expand All @@ -33,8 +33,8 @@ var PassthroughEncryption EncryptionFunction = func(plaintext []byte) ([]byte, e
}

// EncoderExtension is a JSON encoder extension for the encryption and decryption of JSON
// encoded data. It supports full encryption / decryption of the encoded block in in
// addition to sparse encryption and hashing of structs on a per field basis via supplementary
// encoded data. It supports full encryption / decryption of the encoded block in
// addition to sparse encryption and hashing of structs on a per-field basis via supplementary
// JSON struct field tag options. For additional information on sparse encryption & hashing, please
// SEE: https://github.com/jrapoport/chestnut/blob/master/README.md
//
Expand Down Expand Up @@ -64,7 +64,7 @@ func NewSecureEncoderExtension(encoderID string, efn EncryptionFunction, opt ...
opts = applyOptions(opts, opt...)
encoder := encoders.NewEncoder()
logName := fmt.Sprintf("%s [%s]", encoderName, encoderID)
token := lookup.NewLookupToken(SecureLookupPrefix, encoderID)
token := lookup.NewLookupToken(LookupPrefix, encoderID)
ext := new(EncoderExtension)
ext.opts = opts
ext.log = log.Named(opts.log, logName)
Expand Down
6 changes: 3 additions & 3 deletions encoding/json/encoders/secure/encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package secure

import (
"errors"
"github.com/jrapoport/chestnut/log"
"reflect"
"testing"

"github.com/jrapoport/chestnut/encoding/json/encoders"
"github.com/jrapoport/chestnut/encoding/json/packager"
"github.com/jrapoport/chestnut/log"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -36,7 +36,7 @@ var encoderTests = []encoderTest{
func TestSecureEncoderExtension(t *testing.T) {
for _, test := range encoderTests {
testName := reflect.TypeOf(test.src).Elem().Name()
if test.compressed != nil {
if test.compressed != noOpt {
testName += " compressed"
}
t.Run(testName, func(t *testing.T) {
Expand All @@ -59,7 +59,7 @@ func TestSecureEncoderExtension(t *testing.T) {
sealed, err := encoderExt.Seal(encoded)
assert.NoError(t, err)
assert.Equal(t, test.sealed, sealed)
// unwrap the sealed package & ake sure it is valid
// unwrap the sealed package & make sure it is valid
pkg, err := packager.DecodePackage(sealed)
assert.NoError(t, err)
assert.NotNil(t, pkg)
Expand Down
Loading

0 comments on commit 009a7c2

Please sign in to comment.