1
1
mirror of https://github.com/wader/fq.git synced 2024-12-25 14:23:18 +03:00

Merge pull request #361 from wader/bump-github-golangci-lint-1.48.0

Update github-golangci-lint from 1.47.3 to 1.48.0
This commit is contained in:
Mattias Wadman 2022-08-05 00:30:53 +02:00 committed by GitHub
commit e903dac47f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 46 additions and 37 deletions

View File

@ -7,7 +7,7 @@ on:
pull_request:
env:
GOLANGCILINT_VERSION: 1.47.3
GOLANGCILINT_VERSION: 1.48.0
jobs:
lint:

View File

@ -4,13 +4,13 @@ package main
import (
"bytes"
"io/ioutil"
"io"
"os"
"strconv"
)
func main() {
bs, err := ioutil.ReadAll(os.Stdin)
bs, err := io.ReadAll(os.Stdin)
if err != nil {
panic(err)
}

View File

@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"errors"
"io/ioutil"
"io"
"log"
"os"
"strconv"
@ -82,7 +82,7 @@ func main() {
_ = json.NewDecoder(r).Decode(&data)
}
templateBytes, err := ioutil.ReadAll(os.Stdin)
templateBytes, err := io.ReadAll(os.Stdin)
if err != nil {
panic(err)
}

View File

@ -1,4 +1,5 @@
// Package all registers all builtin formats with the default registry
//
//nolint:revive
package all

View File

@ -8,6 +8,7 @@ const (
)
// TODO: change to CamelCase?
//
//nolint:revive
const (
ALL = "all"

View File

@ -6,7 +6,6 @@ import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"testing"
@ -46,8 +45,8 @@ func (ft *fuzzTest) Platform() interp.Platform { return interp.Platform{} }
func (ft *fuzzTest) Stdin() interp.Input {
return fuzzTestInput{FileReader: interp.FileReader{R: bytes.NewBuffer(ft.b)}}
}
func (ft *fuzzTest) Stdout() interp.Output { return fuzzTestOutput{ioutil.Discard} }
func (ft *fuzzTest) Stderr() interp.Output { return fuzzTestOutput{ioutil.Discard} }
func (ft *fuzzTest) Stdout() interp.Output { return fuzzTestOutput{io.Discard} }
func (ft *fuzzTest) Stderr() interp.Output { return fuzzTestOutput{io.Discard} }
func (ft *fuzzTest) InterruptChan() chan struct{} { return nil }
func (ft *fuzzTest) Environ() []string { return nil }
func (ft *fuzzTest) Args() []string {
@ -85,7 +84,7 @@ func FuzzFormats(f *testing.F) {
return err
}
b, readErr := ioutil.ReadFile(path)
b, readErr := os.ReadFile(path)
if readErr != nil {
f.Fatal(err)
}

View File

@ -227,10 +227,14 @@ const (
// $00 ISO-8859-1 [ISO-8859-1]. Terminated with $00.
// $01 UTF-16 [UTF-16] encoded Unicode [UNICODE] with BOM. All
//
// strings in the same frame SHALL have the same byteorder.
// Terminated with $00 00.
//
// $02 UTF-16BE [UTF-16] encoded Unicode [UNICODE] without BOM.
//
// Terminated with $00 00.
//
// $03 UTF-8 [UTF-8] encoded Unicode [UNICODE]. Terminated with $00.
var encodingNames = scalar.UToSymStr{
encodingISO8859_1: "iso_8859-1",

View File

@ -4,6 +4,7 @@ import "github.com/wader/fq/pkg/scalar"
// from https://www.tcpdump.org/linktypes.html
// TODO cleanup
//
//nolint:revive
const (
LinkTypeNULL = 0

View File

@ -1,4 +1,5 @@
// Code below generated from ebml_matroska.xml
//
//nolint:revive
package ebml_matroska

View File

@ -5,6 +5,7 @@ import (
)
// based on ffmpeg libavformat/isom.c ff_mp4_obj_type
//
//nolint:revive
const (
MPEGObjectTypeMOV_TEXT = 0x08
@ -191,6 +192,7 @@ var MPEGAudioObjectTypeNames = scalar.UToScalar{
}
// based on ffmpeg/libavutil/pixfmt.h
//
//nolint:revive
var ISO_23091_2_ColourPrimariesMap = scalar.UToScalar{
1: {Sym: "bt709", Description: "ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B"},

View File

@ -73,6 +73,7 @@ func decodeEscapeValueAbsFn(b1 int, b2 int, b3 int) func(d *decode.D) uint64 {
}
// add values and escaped values
//
//nolint:deadcode,unused
func decodeEscapeValueAddFn(b1 int, b2 int, b3 int) func(d *decode.D) uint64 {
return decodeEscapeValueFn(0, b1, b2, b3)

View File

@ -195,6 +195,7 @@ var videoMessageH264PacketTypeNames = scalar.UToSymStr{
}
// TODO: invalid warning that timestampDelta is unused
//nolint:unused
type messageHeader struct {
timestamp uint64

View File

@ -24,6 +24,7 @@
//
// skip errcheck to keep code similar to gojq version
//
//nolint:errcheck
package colorjson

View File

@ -11,7 +11,6 @@
package difftest
import (
"io/ioutil"
"os"
"path/filepath"
"strings"
@ -139,7 +138,7 @@ func TestWithOptions(t *testing.T, opts Options) {
for _, p := range paths {
t.Run(p, func(t *testing.T) {
t.Helper()
input, err := ioutil.ReadFile(p)
input, err := os.ReadFile(p)
if err != nil {
t.Fatal(err)
}
@ -149,13 +148,13 @@ func TestWithOptions(t *testing.T, opts Options) {
t.Fatal(err)
}
expectedOutput, expectedOutputErr := ioutil.ReadFile(outputPath)
expectedOutput, expectedOutputErr := os.ReadFile(outputPath)
if opts.WriteOutput {
if expectedOutputErr == nil && string(expectedOutput) == output {
return
}
if err := ioutil.WriteFile(outputPath, []byte(output), 0644); err != nil { //nolint:gosec
if err := os.WriteFile(outputPath, []byte(output), 0644); err != nil { //nolint:gosec
t.Fatal(err)
}
return

View File

@ -16,6 +16,7 @@ import (
)
// Cast gojq value to go value
//
//nolint:forcetypeassert,unconvert
func CastFn[T any](v any, structFn func(input any, result any) error) (T, bool) {
var t T

View File

@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//nolint:revive
package mathextra

View File

@ -5,7 +5,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"math/big"
"regexp"
@ -1129,7 +1128,7 @@ func (d *D) FieldFormatReaderLen(name string, nBits int64, fn func(r io.Reader)
if err != nil {
d.IOPanic(err, "FieldFormatReaderLen: fn")
}
rBuf, err := ioutil.ReadAll(r)
rBuf, err := io.ReadAll(r)
if err != nil {
d.IOPanic(err, "FieldFormatReaderLen: ReadAll")
}
@ -1149,7 +1148,7 @@ func (d *D) TryFieldReaderRangeFormat(name string, startBit int64, nBits int64,
return 0, nil, nil, nil, err
}
r := bitio.NewIOReadSeeker(br)
rb, err := ioutil.ReadAll(fn(r))
rb, err := io.ReadAll(fn(r))
if err != nil {
return 0, nil, nil, nil, err
}

View File

@ -145,6 +145,7 @@ func (d *D) tryText(nBytes int, e encoding.Encoding) (string, error) {
// read length prefixed text (ex pascal short string)
// lBits length prefix
// fixedBytes if != -1 read nBytes but trim to length
//
//nolint:unparam
func (d *D) tryTextLenPrefixed(lenBits int, fixedBytes int, e encoding.Encoding) (string, error) {
if lenBits < 0 {

View File

@ -2,7 +2,6 @@ package fqtest
import (
"context"
"io/ioutil"
"os"
"strconv"
"testing"
@ -19,7 +18,7 @@ func TestPath(t *testing.T, registry *interp.Registry) {
ColorDiff: os.Getenv("DIFF_COLOR") != "",
WriteOutput: os.Getenv("WRITE_ACTUAL") != "",
Fn: func(t *testing.T, path, input string) (string, string, error) {
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}

View File

@ -6,7 +6,6 @@ import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"math/big"
"github.com/wader/fq/internal/aheadreadseeker"
@ -217,7 +216,7 @@ func (i *Interp) _open(c any) any {
}
if fRS == nil {
buf, err := ioutil.ReadAll(ctxreadseeker.New(i.EvalInstance.Ctx, &ioextra.ReadErrSeeker{Reader: f}))
buf, err := io.ReadAll(ctxreadseeker.New(i.EvalInstance.Ctx, &ioextra.ReadErrSeeker{Reader: f}))
if err != nil {
f.Close()
return err

View File

@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"math/big"
"reflect"
"strings"
@ -143,7 +142,7 @@ func (i *Interp) _registry(c any) any {
if err != nil {
return err
}
b, err := ioutil.ReadAll(f)
b, err := io.ReadAll(f)
if err != nil {
return err
}

View File

@ -11,7 +11,6 @@ import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"math/big"
"path"
"strconv"
@ -917,7 +916,7 @@ func (i *Interp) Eval(ctx context.Context, c any, expr string, opts EvalOpts) (g
output := opts.output
if opts.output == nil {
output = ioutil.Discard
output = io.Discard
}
runCtx, runCtxCancelFn := i.interruptStack.Push(ctx)