Skip to content

Commit

Permalink
run gofmt -s
Browse files Browse the repository at this point in the history
  • Loading branch information
web3-bot authored and rvagg committed Aug 25, 2022
1 parent 890f55d commit 5b6a9dc
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion _rsrch/cidiface/cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ type Cid interface {
// and the Multihash length. It does not contains
// any actual content information.
// NOTE: The use -1 in MhLength to mean default length is deprecated,
// use the V0Builder or V1Builder structures instead
//
// use the V0Builder or V1Builder structures instead
type Prefix struct {
Version uint64
Codec uint64
Expand Down
11 changes: 5 additions & 6 deletions _rsrch/cidiface/cidBoxingBench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
//
// Sample results on linux amd64 go1.11beta:
//
// BenchmarkCidMap_CidStr-8 100000 16317 ns/op
// BenchmarkCidMap_CidIface-8 100000 20516 ns/op
// BenchmarkCidMap_CidStr-8 100000 16317 ns/op
// BenchmarkCidMap_CidIface-8 100000 20516 ns/op
//
// With benchmem on:
//
// BenchmarkCidMap_CidStr-8 100000 15579 ns/op 11223 B/op 207 allocs/op
// BenchmarkCidMap_CidIface-8 100000 19500 ns/op 12824 B/op 307 allocs/op
// BenchmarkCidMap_StrPlusHax-8 200000 10451 ns/op 7589 B/op 202 allocs/op
// BenchmarkCidMap_CidStr-8 100000 15579 ns/op 11223 B/op 207 allocs/op
// BenchmarkCidMap_CidIface-8 100000 19500 ns/op 12824 B/op 307 allocs/op
// BenchmarkCidMap_StrPlusHax-8 200000 10451 ns/op 7589 B/op 202 allocs/op
//
// We can see here that the impact of interface boxing is significant:
// it increases the time taken to do the inserts to 133%, largely because
Expand All @@ -36,7 +36,6 @@ import (
// re-arranges itself, it involves more or less an O(n) copy of the content
// in addition to the alloc itself). This isn't topical to the question of
// whether or not interfaces are a good idea; just for contextualizing.
//
func BenchmarkCidMap_CidStr(b *testing.B) {
for i := 0; i < b.N; i++ {
mp := map[CidStr]int{}
Expand Down
2 changes: 1 addition & 1 deletion _rsrch/cidiface/cidString.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func NewCidStr(version uint64, codecType uint64, mhash mh.Multihash) CidStr {
//
// For CidV1, the data buffer is in the form:
//
// <version><codec-type><multihash>
// <version><codec-type><multihash>
//
// CidV0 are also supported. In particular, data buffers starting
// with length 34 bytes, which starts with bytes [18,32...] are considered
Expand Down
2 changes: 1 addition & 1 deletion _rsrch/cidiface/cidStruct.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (c CidStruct) Prefix() Prefix {
//
// For CidV1, the data buffer is in the form:
//
// <version><codec-type><multihash>
// <version><codec-type><multihash>
//
// CidV0 are also supported. In particular, data buffers starting
// with length 34 bytes, which starts with bytes [18,32...] are considered
Expand Down
13 changes: 7 additions & 6 deletions cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
// A CIDv1 has four parts:
//
// <cidv1> ::= <multibase-prefix><cid-version><multicodec-packed-content-type><multihash-content-address>
// <cidv1> ::= <multibase-prefix><cid-version><multicodec-packed-content-type><multihash-content-address>
//
// As shown above, the CID implementation relies heavily on Multiformats,
// particularly Multibase
Expand Down Expand Up @@ -193,7 +193,7 @@ func MustParse(v interface{}) Cid {
// Decode parses a Cid-encoded string and returns a Cid object.
// For CidV1, a Cid-encoded string is primarily a multibase string:
//
// <multibase-type-code><base-encoded-string>
// <multibase-type-code><base-encoded-string>
//
// The base-encoded string represents a:
//
Expand Down Expand Up @@ -249,7 +249,7 @@ func ExtractEncoding(v string) (mbase.Encoding, error) {
// Cast takes a Cid data slice, parses it and returns a Cid.
// For CidV1, the data buffer is in the form:
//
// <version><codec-type><multihash>
// <version><codec-type><multihash>
//
// CidV0 are also supported. In particular, data buffers starting
// with length 34 bytes, which starts with bytes [18,32...] are considered
Expand Down Expand Up @@ -465,7 +465,7 @@ func (c *Cid) UnmarshalJSON(b []byte) error {

// MarshalJSON procudes a JSON representation of a Cid, which looks as follows:
//
// { "/": "<cid-string>" }
// { "/": "<cid-string>" }
//
// Note that this formatting comes from the IPLD specification
// (https://github.com/ipld/specs/tree/master/ipld)
Expand Down Expand Up @@ -522,7 +522,8 @@ func (c Cid) Prefix() Prefix {
// and the Multihash length. It does not contains
// any actual content information.
// NOTE: The use -1 in MhLength to mean default length is deprecated,
// use the V0Builder or V1Builder structures instead
//
// use the V0Builder or V1Builder structures instead
type Prefix struct {
Version uint64
Codec uint64
Expand Down Expand Up @@ -561,7 +562,7 @@ func (p Prefix) Sum(data []byte) (Cid, error) {

// Bytes returns a byte representation of a Prefix. It looks like:
//
// <version><codec><mh-type><mh-length>
// <version><codec><mh-type><mh-length>
func (p Prefix) Bytes() []byte {
size := varint.UvarintSize(p.Version)
size += varint.UvarintSize(p.Codec)
Expand Down

0 comments on commit 5b6a9dc

Please sign in to comment.