Skip to content

Commit

Permalink
chore: Go 1.19
Browse files Browse the repository at this point in the history
Signed-off-by: Valery Piashchynski <[email protected]>
  • Loading branch information
rustatian committed Aug 4, 2022
1 parent 2db7550 commit 1c2a2bc
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19

- name: Run linter
uses: golangci/golangci-lint-action@v3 # Action page: <https://github.com/golangci/golangci-lint-action>
with:
version: v1.47 # without patch version
version: v1.48 # without patch version
only-new-issues: false # show only new issues if it's a pull request
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: true
matrix:
go: [ 1.18 ]
go: [ 1.19 ]
os: [ ubuntu-latest ]
steps:
- name: Set up Go ${{ matrix.go }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: true
matrix:
go: [ 1.18 ]
go: [ 1.19 ]
os: [ macos-latest ]
steps:
- name: Set up Go ${{ matrix.go }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: true
matrix:
go: [ 1.18 ]
go: [ 1.19 ]
os: [ windows-latest ]
steps:
- name: Set up Go ${{ matrix.go }}
Expand Down
6 changes: 3 additions & 3 deletions internal/bpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ func Preallocate() {

func internalAllocate() {
pool1 := &sync.Pool{
New: func() interface{} {
New: func() any {
data := make([]byte, OneMB)
return &data
},
}
pool5 := &sync.Pool{
New: func() interface{} {
New: func() any {
data := make([]byte, FiveMB)
return &data
},
}
pool10 := &sync.Pool{
New: func() interface{} {
New: func() any {
data := make([]byte, TenMB)
return &data
},
Expand Down
8 changes: 4 additions & 4 deletions pkg/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ type ClientCodec struct {
// NewClientCodec initiates new server rpc codec over socket connection.
func NewClientCodec(rwc io.ReadWriteCloser) *ClientCodec {
return &ClientCodec{
bPool: sync.Pool{New: func() interface{} {
bPool: sync.Pool{New: func() any {
return new(bytes.Buffer)
}},

fPool: sync.Pool{New: func() interface{} {
fPool: sync.Pool{New: func() any {
return frame.NewFrame()
}},

Expand All @@ -61,7 +61,7 @@ func (c *ClientCodec) putFrame(f *frame.Frame) {
}

// WriteRequest writes request to the connection. Sequential.
func (c *ClientCodec) WriteRequest(r *rpc.Request, body interface{}) error {
func (c *ClientCodec) WriteRequest(r *rpc.Request, body any) error {
const op = errors.Op("goridge_write_request")

// get a frame from the pool
Expand Down Expand Up @@ -148,7 +148,7 @@ func (c *ClientCodec) ReadResponseHeader(r *rpc.Response) error {
}

// ReadResponseBody response from the connection.
func (c *ClientCodec) ReadResponseBody(out interface{}) error {
func (c *ClientCodec) ReadResponseBody(out any) error {
const op = errors.Op("client_read_response_body")

// put frame after response was sent
Expand Down
8 changes: 4 additions & 4 deletions pkg/rpc/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ func NewCodec(rwc io.ReadWriteCloser) *Codec {
relay: socket.NewSocketRelay(rwc),
codec: sync.Map{},

bPool: sync.Pool{New: func() interface{} {
bPool: sync.Pool{New: func() any {
return new(bytes.Buffer)
}},

fPool: sync.Pool{New: func() interface{} {
fPool: sync.Pool{New: func() any {
return frame.NewFrame()
}},
}
Expand Down Expand Up @@ -68,7 +68,7 @@ func (c *Codec) putFrame(f *frame.Frame) {
}

// WriteResponse marshals response, byte slice or error to remote party.
func (c *Codec) WriteResponse(r *rpc.Response, body interface{}) error { //nolint:funlen
func (c *Codec) WriteResponse(r *rpc.Response, body any) error { //nolint:funlen
const op = errors.Op("goridge_write_response")
fr := c.getFrame()
defer c.putFrame(fr)
Expand Down Expand Up @@ -292,7 +292,7 @@ func (c *Codec) storeCodec(r *rpc.Request, flag byte) error {

// ReadRequestBody fetches prefixed body data and automatically unmarshal it as json. RawBody flag will populate
// []byte lice argument for rpc method.
func (c *Codec) ReadRequestBody(out interface{}) error {
func (c *Codec) ReadRequestBody(out any) error {
const op = errors.Op("goridge_read_request_body")
if out == nil {
return nil
Expand Down
4 changes: 3 additions & 1 deletion pkg/shared_memory/posix/posix_shm.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ type SharedMemorySegment struct {
data []byte
}

/* The args are:
/*
The args are:
key - int, used as uniques identifier for the shared memory segment
size - uint, size in bytes to allocate
permission - int, if passed zero, 0600 will be used by default
Expand Down

0 comments on commit 1c2a2bc

Please sign in to comment.