Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dcrjson/cmdinfo.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2015 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Copyright (c) 2015-2026 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -138,7 +138,7 @@ func fieldUsage(structField reflect.StructField, defaultVal *reflect.Value) stri

// Indirect the pointer if needed.
fieldType := structField.Type
if fieldType.Kind() == reflect.Ptr {
if fieldType.Kind() == reflect.Pointer {
fieldType = fieldType.Elem()
}

Expand Down Expand Up @@ -189,7 +189,7 @@ func methodUsageText(rtp reflect.Type, defaults map[int]reflect.Value, method in
for i := 0; i < numFields; i++ {
rtf := rt.Field(i)
var isOptional bool
if kind := rtf.Type.Kind(); kind == reflect.Ptr {
if kind := rtf.Type.Kind(); kind == reflect.Pointer {
isOptional = true
}

Expand Down
8 changes: 4 additions & 4 deletions dcrjson/cmdparse.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2014 The btcsuite developers
// Copyright (c) 2015-2022 The Decred developers
// Copyright (c) 2015-2026 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand All @@ -21,7 +21,7 @@ func makeParams(rt reflect.Type, rv reflect.Value) []interface{} {
for i := 0; i < numFields; i++ {
rtf := rt.Field(i)
rvf := rv.Field(i)
if rtf.Type.Kind() == reflect.Ptr {
if rtf.Type.Kind() == reflect.Pointer {
if rvf.IsNil() {
break
}
Expand Down Expand Up @@ -223,7 +223,7 @@ func typesMaybeCompatible(dest reflect.Type, src reflect.Type) bool {
// pointers along with how many indirections were necessary.
func baseType(arg reflect.Type) (reflect.Type, int) {
var numIndirects int
for arg.Kind() == reflect.Ptr {
for arg.Kind() == reflect.Pointer {
arg = arg.Elem()
numIndirects++
}
Expand Down Expand Up @@ -285,7 +285,7 @@ func assignField(paramNum int, fieldName string, dest reflect.Value, src reflect
}

// Indirect through to the base source value.
for src.Kind() == reflect.Ptr {
for src.Kind() == reflect.Pointer {
src = src.Elem()
}

Expand Down
4 changes: 2 additions & 2 deletions dcrjson/cmdparse_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2014 The btcsuite developers
// Copyright (c) 2015-2020 The Decred developers
// Copyright (c) 2015-2026 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -177,7 +177,7 @@ func TestAssignField(t *testing.T) {

// Indirect through to the base types to ensure their values
// are the same.
for dst.Kind() == reflect.Ptr {
for dst.Kind() == reflect.Pointer {
dst = dst.Elem()
}
if !reflect.DeepEqual(dst.Interface(), test.expected) {
Expand Down
2 changes: 1 addition & 1 deletion dcrjson/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/decred/dcrd/dcrjson/v4

go 1.17
go 1.18

require github.com/decred/dcrd/chaincfg/chainhash v1.0.5

Expand Down
12 changes: 6 additions & 6 deletions dcrjson/help.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2015 The btcsuite developers
// Copyright (c) 2015-2022 The Decred developers
// Copyright (c) 2015-2026 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -101,7 +101,7 @@ func resultStructHelp(xT descLookupFunc, rt reflect.Type, indentLevel int) []str

// Deference pointer if needed.
rtfType := rtf.Type
if rtfType.Kind() == reflect.Ptr {
if rtfType.Kind() == reflect.Pointer {
rtfType = rtf.Type.Elem()
}

Expand Down Expand Up @@ -143,7 +143,7 @@ func resultStructHelp(xT descLookupFunc, rt reflect.Type, indentLevel int) []str
// differently.
func reflectTypeToJSONExample(xT descLookupFunc, rt reflect.Type, indentLevel int, fieldDescKey string) ([]string, bool) {
// Indirect pointer if needed.
if rt.Kind() == reflect.Ptr {
if rt.Kind() == reflect.Pointer {
rt = rt.Elem()
}
kind := rt.Kind()
Expand Down Expand Up @@ -287,7 +287,7 @@ func argTypeHelp(xT descLookupFunc, structField reflect.StructField, defaultVal
// Indirect the pointer if needed and track if it's an optional field.
fieldType := structField.Type
var isOptional bool
if fieldType.Kind() == reflect.Ptr {
if fieldType.Kind() == reflect.Pointer {
fieldType = fieldType.Elem()
isOptional = true
}
Expand Down Expand Up @@ -354,7 +354,7 @@ func argHelp(xT descLookupFunc, rtp reflect.Type, defaults map[int]reflect.Value
// For types which require a JSON object, or an array of JSON
// objects, generate the full syntax for the argument.
fieldType := rtf.Type
if fieldType.Kind() == reflect.Ptr {
if fieldType.Kind() == reflect.Pointer {
fieldType = fieldType.Elem()
}
kind := fieldType.Kind()
Expand Down Expand Up @@ -524,7 +524,7 @@ func GenerateHelp(method interface{}, descs map[string]string, resultTypes ...in
}

rtp := reflect.TypeOf(resultType)
if rtp.Kind() != reflect.Ptr {
if rtp.Kind() != reflect.Pointer {
str := fmt.Sprintf("result #%d (%v) is not a pointer",
i, rtp.Kind())
return "", makeError(ErrInvalidType, str)
Expand Down
10 changes: 5 additions & 5 deletions dcrjson/register.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2014 The btcsuite developers
// Copyright (c) 2015-2019 The Decred developers
// Copyright (c) 2015-2026 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -95,7 +95,7 @@ var (
// indirecting through all pointers.
func baseKindString(rt reflect.Type) string {
numIndirects := 0
for rt.Kind() == reflect.Ptr {
for rt.Kind() == reflect.Pointer {
numIndirects++
rt = rt.Elem()
}
Expand All @@ -116,7 +116,7 @@ func isAcceptableKind(kind reflect.Kind) bool {
fallthrough
case reflect.Func:
fallthrough
case reflect.Ptr:
case reflect.Pointer:
fallthrough
case reflect.Interface:
return false
Expand Down Expand Up @@ -188,7 +188,7 @@ func Register(method interface{}, params interface{}, flags UsageFlag) error {
return makeError(ErrInvalidUsageFlags, str)
}

if rtp.Kind() != reflect.Ptr {
if rtp.Kind() != reflect.Pointer {
str := fmt.Sprintf("type must be *struct not '%s (%s)'", rtp,
rtp.Kind())
return makeError(ErrInvalidType, str)
Expand Down Expand Up @@ -222,7 +222,7 @@ func Register(method interface{}, params interface{}, flags UsageFlag) error {
// if the field is optional based on it being a pointer.
var isOptional bool
switch kind := rtf.Type.Kind(); kind {
case reflect.Ptr:
case reflect.Pointer:
isOptional = true
kind = rtf.Type.Elem().Kind()
fallthrough
Expand Down
10 changes: 5 additions & 5 deletions wire/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestElementWire(t *testing.T) {
// Read from wire format.
rbuf := bytes.NewReader(test.buf)
val := test.in
if reflect.ValueOf(test.in).Kind() != reflect.Ptr {
if reflect.ValueOf(test.in).Kind() != reflect.Pointer {
val = reflect.New(reflect.TypeOf(test.in)).Interface()
}
err = readElement(rbuf, val)
Expand All @@ -175,7 +175,7 @@ func TestElementWire(t *testing.T) {
continue
}
ival := val
if reflect.ValueOf(test.in).Kind() != reflect.Ptr {
if reflect.ValueOf(test.in).Kind() != reflect.Pointer {
ival = reflect.Indirect(reflect.ValueOf(val)).Interface()
}
if !reflect.DeepEqual(ival, test.in) {
Expand All @@ -187,7 +187,7 @@ func TestElementWire(t *testing.T) {
// Read from wire format again, but this time with a one byte reader.
obr := iotest.OneByteReader(bytes.NewReader(test.buf))
val = test.in
if reflect.ValueOf(test.in).Kind() != reflect.Ptr {
if reflect.ValueOf(test.in).Kind() != reflect.Pointer {
val = reflect.New(reflect.TypeOf(test.in)).Interface()
}
err = readElement(obr, val)
Expand All @@ -196,7 +196,7 @@ func TestElementWire(t *testing.T) {
continue
}
ival = val
if reflect.ValueOf(test.in).Kind() != reflect.Ptr {
if reflect.ValueOf(test.in).Kind() != reflect.Pointer {
ival = reflect.Indirect(reflect.ValueOf(val)).Interface()
}
if !reflect.DeepEqual(ival, test.in) {
Expand Down Expand Up @@ -263,7 +263,7 @@ func TestElementWireErrors(t *testing.T) {
// Decode from wire format.
r := newFixedReader(test.max, nil)
val := test.in
if reflect.ValueOf(test.in).Kind() != reflect.Ptr {
if reflect.ValueOf(test.in).Kind() != reflect.Pointer {
val = reflect.New(reflect.TypeOf(test.in)).Interface()
}
err = readElement(r, val)
Expand Down
2 changes: 1 addition & 1 deletion wire/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/decred/dcrd/wire

go 1.17
go 1.18

require (
github.com/davecgh/go-spew v1.1.1
Expand Down