Skip to content

Commit

Permalink
Merge pull request ipfs#71 from ipfs/rvagg/staticcheck
Browse files Browse the repository at this point in the history
Fix staticcheck warnings
  • Loading branch information
Stebalien authored Jul 20, 2021
2 parents 1c3bc18 + 40f5034 commit be31d39
Showing 1 changed file with 87 additions and 88 deletions.
175 changes: 87 additions & 88 deletions pb/merkledag.pb.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: merkledag.proto
// Code originally generated by protoc-gen-gogo from merkledag.proto,
// now manually managed

package merkledag_pb

import (
bytes "bytes"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
reflect "reflect"
strings "strings"

_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
)

// DoNotUpgradeFileEverItWillChangeYourHashes warns users about not breaking
Expand Down Expand Up @@ -184,9 +185,9 @@ var fileDescriptor_10837cc3557cec00 = []byte{
0x01, 0x00, 0x00,
}

func (this *PBLink) VerboseEqual(that interface{}) error {
func (pbLink *PBLink) VerboseEqual(that interface{}) error {
if that == nil {
if this == nil {
if pbLink == nil {
return nil
}
return fmt.Errorf("that == nil && this != nil")
Expand All @@ -202,42 +203,42 @@ func (this *PBLink) VerboseEqual(that interface{}) error {
}
}
if that1 == nil {
if this == nil {
if pbLink == nil {
return nil
}
return fmt.Errorf("that is type *PBLink but is nil && this != nil")
} else if this == nil {
} else if pbLink == nil {
return fmt.Errorf("that is type *PBLink but is not nil && this == nil")
}
if !bytes.Equal(this.Hash, that1.Hash) {
return fmt.Errorf("Hash this(%v) Not Equal that(%v)", this.Hash, that1.Hash)
if !bytes.Equal(pbLink.Hash, that1.Hash) {
return fmt.Errorf("this.Hash(%v) is not equal to that.Hash(%v)", pbLink.Hash, that1.Hash)
}
if this.Name != nil && that1.Name != nil {
if *this.Name != *that1.Name {
return fmt.Errorf("Name this(%v) Not Equal that(%v)", *this.Name, *that1.Name)
if pbLink.Name != nil && that1.Name != nil {
if *pbLink.Name != *that1.Name {
return fmt.Errorf("this.Name(%v) is not equal to that.Name(%v)", *pbLink.Name, *that1.Name)
}
} else if this.Name != nil {
} else if pbLink.Name != nil {
return fmt.Errorf("this.Name == nil && that.Name != nil")
} else if that1.Name != nil {
return fmt.Errorf("Name this(%v) Not Equal that(%v)", this.Name, that1.Name)
return fmt.Errorf("this.Name(%v) is not equal to that.Name(%v)", pbLink.Name, that1.Name)
}
if this.Tsize != nil && that1.Tsize != nil {
if *this.Tsize != *that1.Tsize {
return fmt.Errorf("Tsize this(%v) Not Equal that(%v)", *this.Tsize, *that1.Tsize)
if pbLink.Tsize != nil && that1.Tsize != nil {
if *pbLink.Tsize != *that1.Tsize {
return fmt.Errorf("this.Tsize(%v) is not equal to that.Tsize(%v)", *pbLink.Tsize, *that1.Tsize)
}
} else if this.Tsize != nil {
} else if pbLink.Tsize != nil {
return fmt.Errorf("this.Tsize == nil && that.Tsize != nil")
} else if that1.Tsize != nil {
return fmt.Errorf("Tsize this(%v) Not Equal that(%v)", this.Tsize, that1.Tsize)
return fmt.Errorf("this.Tsize(%v) is not equal to that.Tsize(%v)", pbLink.Tsize, that1.Tsize)
}
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
if !bytes.Equal(pbLink.XXX_unrecognized, that1.XXX_unrecognized) {
return fmt.Errorf("XXX_unrecognized this(%v) is not equal to that(%v)", pbLink.XXX_unrecognized, that1.XXX_unrecognized)
}
return nil
}
func (this *PBLink) Equal(that interface{}) bool {
func (pbLink *PBLink) Equal(that interface{}) bool {
if that == nil {
return this == nil
return pbLink == nil
}

that1, ok := that.(*PBLink)
Expand All @@ -250,39 +251,39 @@ func (this *PBLink) Equal(that interface{}) bool {
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return pbLink == nil
} else if pbLink == nil {
return false
}
if !bytes.Equal(this.Hash, that1.Hash) {
if !bytes.Equal(pbLink.Hash, that1.Hash) {
return false
}
if this.Name != nil && that1.Name != nil {
if *this.Name != *that1.Name {
if pbLink.Name != nil && that1.Name != nil {
if *pbLink.Name != *that1.Name {
return false
}
} else if this.Name != nil {
} else if pbLink.Name != nil {
return false
} else if that1.Name != nil {
return false
}
if this.Tsize != nil && that1.Tsize != nil {
if *this.Tsize != *that1.Tsize {
if pbLink.Tsize != nil && that1.Tsize != nil {
if *pbLink.Tsize != *that1.Tsize {
return false
}
} else if this.Tsize != nil {
} else if pbLink.Tsize != nil {
return false
} else if that1.Tsize != nil {
return false
}
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
if !bytes.Equal(pbLink.XXX_unrecognized, that1.XXX_unrecognized) {
return false
}
return true
}
func (this *PBNode) VerboseEqual(that interface{}) error {
func (pbLink *PBNode) VerboseEqual(that interface{}) error {
if that == nil {
if this == nil {
if pbLink == nil {
return nil
}
return fmt.Errorf("that == nil && this != nil")
Expand All @@ -298,32 +299,33 @@ func (this *PBNode) VerboseEqual(that interface{}) error {
}
}
if that1 == nil {
if this == nil {
if pbLink == nil {
return nil
}
return fmt.Errorf("that is type *PBNode but is nil && this != nil")
} else if this == nil {
} else if pbLink == nil {
return fmt.Errorf("that is type *PBNode but is not nil && this == nil")
}
if len(this.Links) != len(that1.Links) {
return fmt.Errorf("Links this(%v) Not Equal that(%v)", len(this.Links), len(that1.Links))
if len(pbLink.Links) != len(that1.Links) {
return fmt.Errorf("len(this.Links)(%v) is not equal to len(that.Links)(%v)", len(pbLink.Links), len(that1.Links))
}
for i := range this.Links {
if !this.Links[i].Equal(that1.Links[i]) {
return fmt.Errorf("Links this[%v](%v) Not Equal that[%v](%v)", i, this.Links[i], i, that1.Links[i])
for i := range pbLink.Links {
if !pbLink.Links[i].Equal(that1.Links[i]) {
return fmt.Errorf("this.Links[%v](%v) is not equal to that.Links[%v](%v)", i, pbLink.Links[i], i, that1.Links[i])
}
}
if !bytes.Equal(this.Data, that1.Data) {
return fmt.Errorf("Data this(%v) Not Equal that(%v)", this.Data, that1.Data)
if !bytes.Equal(pbLink.Data, that1.Data) {
return fmt.Errorf("this.Data(%v) is not equal to that.Data(%v)", pbLink.Data, that1.Data)
}
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
if !bytes.Equal(pbLink.XXX_unrecognized, that1.XXX_unrecognized) {
return fmt.Errorf("this.XXX_unrecognized(%v) is not equal to that.XXX_unrecognized(%v)", pbLink.XXX_unrecognized, that1.XXX_unrecognized)
}
return nil
}
func (this *PBNode) Equal(that interface{}) bool {

func (pbNode *PBNode) Equal(that interface{}) bool {
if that == nil {
return this == nil
return pbNode == nil
}

that1, ok := that.(*PBNode)
Expand All @@ -336,61 +338,61 @@ func (this *PBNode) Equal(that interface{}) bool {
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return pbNode == nil
} else if pbNode == nil {
return false
}
if len(this.Links) != len(that1.Links) {
if len(pbNode.Links) != len(that1.Links) {
return false
}
for i := range this.Links {
if !this.Links[i].Equal(that1.Links[i]) {
for i := range pbNode.Links {
if !pbNode.Links[i].Equal(that1.Links[i]) {
return false
}
}
if !bytes.Equal(this.Data, that1.Data) {
if !bytes.Equal(pbNode.Data, that1.Data) {
return false
}
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
if !bytes.Equal(pbNode.XXX_unrecognized, that1.XXX_unrecognized) {
return false
}
return true
}
func (this *PBLink) GoString() string {
if this == nil {
func (pbLink *PBLink) GoString() string {
if pbLink == nil {
return "nil"
}
s := make([]string, 0, 7)
s = append(s, "&merkledag_pb.PBLink{")
if this.Hash != nil {
s = append(s, "Hash: "+valueToGoStringMerkledag(this.Hash, "byte")+",\n")
if pbLink.Hash != nil {
s = append(s, "Hash: "+valueToGoStringMerkledag(pbLink.Hash, "byte")+",\n")
}
if this.Name != nil {
s = append(s, "Name: "+valueToGoStringMerkledag(this.Name, "string")+",\n")
if pbLink.Name != nil {
s = append(s, "Name: "+valueToGoStringMerkledag(pbLink.Name, "string")+",\n")
}
if this.Tsize != nil {
s = append(s, "Tsize: "+valueToGoStringMerkledag(this.Tsize, "uint64")+",\n")
if pbLink.Tsize != nil {
s = append(s, "Tsize: "+valueToGoStringMerkledag(pbLink.Tsize, "uint64")+",\n")
}
if this.XXX_unrecognized != nil {
s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
if pbLink.XXX_unrecognized != nil {
s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", pbLink.XXX_unrecognized)+",\n")
}
s = append(s, "}")
return strings.Join(s, "")
}
func (this *PBNode) GoString() string {
if this == nil {
func (pbNode *PBNode) GoString() string {
if pbNode == nil {
return "nil"
}
s := make([]string, 0, 6)
s = append(s, "&merkledag_pb.PBNode{")
if this.Links != nil {
s = append(s, "Links: "+fmt.Sprintf("%#v", this.Links)+",\n")
if pbNode.Links != nil {
s = append(s, "Links: "+fmt.Sprintf("%#v", pbNode.Links)+",\n")
}
if this.Data != nil {
s = append(s, "Data: "+valueToGoStringMerkledag(this.Data, "byte")+",\n")
if pbNode.Data != nil {
s = append(s, "Data: "+valueToGoStringMerkledag(pbNode.Data, "byte")+",\n")
}
if this.XXX_unrecognized != nil {
s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
if pbNode.XXX_unrecognized != nil {
s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", pbNode.XXX_unrecognized)+",\n")
}
s = append(s, "}")
return strings.Join(s, "")
Expand Down Expand Up @@ -673,35 +675,32 @@ func (m *PBNode) Size() (n int) {
func sovMerkledag(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozMerkledag(x uint64) (n int) {
return sovMerkledag(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *PBLink) String() string {
if this == nil {
func (pbLink *PBLink) String() string {
if pbLink == nil {
return "nil"
}
s := strings.Join([]string{`&PBLink{`,
`Hash:` + valueToStringMerkledag(this.Hash) + `,`,
`Name:` + valueToStringMerkledag(this.Name) + `,`,
`Tsize:` + valueToStringMerkledag(this.Tsize) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`Hash:` + valueToStringMerkledag(pbLink.Hash) + `,`,
`Name:` + valueToStringMerkledag(pbLink.Name) + `,`,
`Tsize:` + valueToStringMerkledag(pbLink.Tsize) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", pbLink.XXX_unrecognized) + `,`,
`}`,
}, "")
return s
}
func (this *PBNode) String() string {
if this == nil {
func (pbNode *PBNode) String() string {
if pbNode == nil {
return "nil"
}
repeatedStringForLinks := "[]*PBLink{"
for _, f := range this.Links {
for _, f := range pbNode.Links {
repeatedStringForLinks += strings.Replace(f.String(), "PBLink", "PBLink", 1) + ","
}
repeatedStringForLinks += "}"
s := strings.Join([]string{`&PBNode{`,
`Data:` + valueToStringMerkledag(this.Data) + `,`,
`Data:` + valueToStringMerkledag(pbNode.Data) + `,`,
`Links:` + repeatedStringForLinks + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", pbNode.XXX_unrecognized) + `,`,
`}`,
}, "")
return s
Expand Down

0 comments on commit be31d39

Please sign in to comment.