Skip to content

Commit

Permalink
first batch of lint warnings reduced
Browse files Browse the repository at this point in the history
  • Loading branch information
jbsv committed Feb 8, 2025
1 parent 407063e commit 659a9b6
Show file tree
Hide file tree
Showing 20 changed files with 114 additions and 72 deletions.
8 changes: 5 additions & 3 deletions core/ordering/cosipbft/blockstore/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,12 @@ func (s *InDisk) Get(id types.Digest) (types.BlockLink, error) {

// GetByIndex implements blockstore.BlockStore. It returns the block associated
// to the index if it exists, otherwise it returns an error.
func (s *InDisk) GetByIndex(index uint64) (link types.BlockLink, err error) {
func (s *InDisk) GetByIndex(index uint64) (types.BlockLink, error) {
var link types.BlockLink

key := s.makeKey(index)

err = s.doView(func(tx kv.ReadableTx) error {
err := s.doView(func(tx kv.ReadableTx) error {
bucket := tx.GetBucket(s.bucket)

value := bucket.Get(key)
Expand All @@ -187,7 +189,7 @@ func (s *InDisk) GetByIndex(index uint64) (link types.BlockLink, err error) {
return nil
})

return
return link, err
}

// GetChain implements blockstore.Blockstore. It returns a chain to the latest
Expand Down
14 changes: 9 additions & 5 deletions crypto/bls/command/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
"golang.org/x/xerrors"
)

const Base64Pubkey = "Base64Pubkey"
const Base64 = "Base64"
const Pubkey = "Pubkey"

// action defines the different cli actions of the BLS commands. Defining
// functions and printer helps in testing the commands.
type action struct {
Expand Down Expand Up @@ -53,21 +57,21 @@ func (a action) loadSignerAction(flags cli.Flags) error {
var out []byte

switch flags.String("format") {
case "PUBKEY":
case Pubkey:
pubkey, err := a.getPubKey(data)
if err != nil {
return xerrors.Errorf("failed to get PUBKEY: %v", err)
return xerrors.Errorf("failed to get Pubkey: %v", err)
}

out, err = pubkey.MarshalText()
if err != nil {
return xerrors.Errorf("failed to marshal pubkey: %v", err)
}

case "BASE64_PUBKEY":
case Base64Pubkey:
pubkey, err := a.getPubKey(data)
if err != nil {
return xerrors.Errorf("failed to get PUBKEY: %v", err)
return xerrors.Errorf("failed to get Pubkey: %v", err)
}

buf, err := pubkey.MarshalBinary()
Expand All @@ -77,7 +81,7 @@ func (a action) loadSignerAction(flags cli.Flags) error {

out = []byte(base64.StdEncoding.EncodeToString(buf))

case "BASE64":
case Base64:
out = []byte(base64.StdEncoding.EncodeToString(data))

default:
Expand Down
20 changes: 10 additions & 10 deletions crypto/bls/command/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,30 @@ func TestLoadSignerAction(t *testing.T) {
err = action.loadSignerAction(set)
require.EqualError(t, err, "unknown format ''")

set["format"] = "PUBKEY"
set["format"] = Pubkey
action.getPubKey = badGetPubKey
err = action.loadSignerAction(set)
require.EqualError(t, err, fake.Err("failed to get PUBKEY"))
require.EqualError(t, err, fake.Err("failed to get Pubkey"))

action.getPubKey = wrongGetPubKey
err = action.loadSignerAction(set)
require.EqualError(t, err, fake.Err("failed to marshal pubkey"))

set["format"] = "BASE64_PUBKEY"
set["format"] = Base64Pubkey
action.getPubKey = badGetPubKey
err = action.loadSignerAction(set)
require.EqualError(t, err, fake.Err("failed to get PUBKEY"))
require.EqualError(t, err, fake.Err("failed to get Pubkey"))

action.getPubKey = wrongGetPubKey
err = action.loadSignerAction(set)
require.EqualError(t, err, fake.Err("failed to marshal pubkey"))

set["format"] = "BASE64_PUBKEY"
set["format"] = Base64Pubkey
action.getPubKey = fakeGetPubKey
err = action.loadSignerAction(set)
require.NoError(t, err)

set["format"] = "BASE64"
set["format"] = Base64
action.getPubKey = badGetPubKey
err = action.loadSignerAction(set)
require.NoError(t, err)
Expand Down Expand Up @@ -128,19 +128,19 @@ func badGenSigner() ([]byte, error) {
return nil, fake.GetError()
}

func badReadFile(path string) ([]byte, error) {
func badReadFile(_ string) ([]byte, error) {
return nil, fake.GetError()
}

func badSaveFile(path string, force bool, data []byte) error {
func badSaveFile(_ string, _ bool, _ []byte) error {
return fake.GetError()
}

func fakeReadFile(path string) ([]byte, error) {
func fakeReadFile(_ string) ([]byte, error) {
return nil, nil
}

func fakeSaveFile(path string, force bool, data []byte) error {
func fakeSaveFile(_ string, _ bool, _ []byte) error {
return nil
}

Expand Down
12 changes: 6 additions & 6 deletions crypto/bls/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ func (i Initializer) SetCommands(provider cli.Provider) {
cmd := provider.SetCommand("bls")
signer := cmd.SetSubCommand("signer")

new := signer.SetSubCommand("new")
new.SetDescription("create a new bls signer")
new.SetFlags(cli.StringFlag{
newsigner := signer.SetSubCommand("newsigner")
newsigner.SetDescription("create a newsigner bls signer")
newsigner.SetFlags(cli.StringFlag{
Name: "save",
Usage: "if provided, save the signer to that file",
Required: false,
Expand All @@ -39,7 +39,7 @@ func (i Initializer) SetCommands(provider cli.Provider) {
Usage: "in the case it saves the signer, will overwrite if needed",
Required: false,
})
new.SetAction(action.newSignerAction)
newsigner.SetAction(action.newSignerAction)

read := signer.SetSubCommand("read")
read.SetDescription("read a signer")
Expand All @@ -49,8 +49,8 @@ func (i Initializer) SetCommands(provider cli.Provider) {
Required: true,
}, cli.StringFlag{
Name: "format",
Usage: "output format: [PUBKEYBASE64 | BASE64_PUBKEY]",
Value: "PUBKEY",
Usage: "output format: [PubkeyBase64 | Base64Pubkey]",
Value: "Pubkey",
Required: false,
})
read.SetAction(action.loadSignerAction)
Expand Down
3 changes: 2 additions & 1 deletion crypto/ed25519/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func TestPubKkeyFormat_Decode(t *testing.T) {

pubkey, err := format.Decode(ctx, data)
require.NoError(t, err)
require.True(t, signer.GetPublicKey().Equal(pubkey.(ed25519.PublicKey)))
p := pubkey.(ed25519.PublicKey)
require.True(t, signer.GetPublicKey().Equal(p))

_, err = format.Decode(ctx, []byte(`{"Data":[]}`))
require.EqualError(t, err,
Expand Down
17 changes: 11 additions & 6 deletions dkg/pedersen/controller/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ func TestDecryptAction_decodeFail(t *testing.T) {
}

func TestDecryptAction_decryptFail(t *testing.T) {
encrypted := "abea449f0ab86029c529f541cdd7f48aee3102b9c1ea2999b5d39c2cc49a4c23:ae29dd65cb4ceaaf7830008b9544625a05b6dbbcd421cf8475aedbef8e8d1da9"
encrypted := "abea449f0ab86029c529f541cdd7f48aee3102b9c1ea2999b5d39c2cc49a4c23" +
":ae29dd65cb4ceaaf7830008b9544625a05b6dbbcd421cf8475aedbef8e8d1da9"
a := decryptAction{}

inj := node.NewInjector()
Expand All @@ -474,7 +475,8 @@ func TestDecryptAction_decryptFail(t *testing.T) {
}

func TestDecryptAction_OK(t *testing.T) {
encrypted := "abea449f0ab86029c529f541cdd7f48aee3102b9c1ea2999b5d39c2cc49a4c23:ae29dd65cb4ceaaf7830008b9544625a05b6dbbcd421cf8475aedbef8e8d1da9"
encrypted := "abea449f0ab86029c529f541cdd7f48aee3102b9c1ea2999b5d39c2cc49a4c23" +
":ae29dd65cb4ceaaf7830008b9544625a05b6dbbcd421cf8475aedbef8e8d1da9"

message := "fake"
expected := hex.EncodeToString([]byte(message))
Expand Down Expand Up @@ -545,8 +547,9 @@ func TestReencryptAction_decodePubkFail(t *testing.T) {
inj.Inject(fakeActor{})

flags := node.FlagSet{
"encrypted": "abea449f0ab86029c529f541cdd7f48aee3102b9c1ea2999b5d39c2cc49a4c23:ae29dd65cb4ceaaf7830008b9544625a05b6dbbcd421cf8475aedbef8e8d1da9",
"pubk": "not hex",
"encrypted": "abea449f0ab86029c529f541cdd7f48aee3102b9c1ea2999b5d39c2cc49a4c23" +
":ae29dd65cb4ceaaf7830008b9544625a05b6dbbcd421cf8475aedbef8e8d1da9",
"pubk": "not hex",
}

ctx := node.Context{
Expand All @@ -559,7 +562,8 @@ func TestReencryptAction_decodePubkFail(t *testing.T) {
}

func TestReencryptAction_reencryptFail(t *testing.T) {
encrypted := "abea449f0ab86029c529f541cdd7f48aee3102b9c1ea2999b5d39c2cc49a4c23:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
encrypted := "abea449f0ab86029c529f541cdd7f48aee3102b9c1ea2999b5d39c2cc49a4c23" +
":aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
pubk := "ae29dd65cb4ceaaf7830008b9544625a05b6dbbcd421cf8475aedbef8e8d1da9"

a := reencryptAction{}
Expand All @@ -584,7 +588,8 @@ func TestReencryptAction_reencryptFail(t *testing.T) {
}

func TestReencryptAction_OK(t *testing.T) {
encrypted := "abea449f0ab86029c529f541cdd7f48aee3102b9c1ea2999b5d39c2cc49a4c23:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
encrypted := "abea449f0ab86029c529f541cdd7f48aee3102b9c1ea2999b5d39c2cc49a4c23" +
":aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
pubk := "ae29dd65cb4ceaaf7830008b9544625a05b6dbbcd421cf8475aedbef8e8d1da9"

sk := suite.Scalar().Pick(suite.RandomStream())
Expand Down
3 changes: 3 additions & 0 deletions dkg/pedersen/dkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,9 @@ func (s *instance) doReshare(
s.startRes.init(start.GetAddrsNew(), start.GetPubkeysNew(), start.GetTNew())

expectedResponses = (start.GetTNew() - 1) * start.GetTOld()

default:
return xerrors.New("unknown node type")
}

// All nodes should certify.
Expand Down
6 changes: 4 additions & 2 deletions dkg/pedersen/pedersen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ func decryptReencrypted(
XhatEnc kyber.Point,
dkgPk kyber.Point,
Sk kyber.Scalar,
) (msg []byte, err error) {
) ([]byte, error) {
var msg []byte

dela.Logger.Debug().Msgf("XhatEnc:%v", XhatEnc)
dela.Logger.Debug().Msgf("DKG pubK:%v", dkgPk)
Expand Down Expand Up @@ -535,5 +536,6 @@ func decryptReencrypted(
}
msg = append(msg, keyPart...)
}
return

return msg, nil
}
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ require (
github.com/opentracing/opentracing-go v1.2.0
github.com/prometheus/client_golang v1.20.5
github.com/rs/xid v1.5.0
github.com/rs/zerolog v1.32.0
github.com/rs/zerolog v1.33.0
github.com/stretchr/testify v1.10.0
github.com/uber/jaeger-client-go v2.30.0+incompatible
github.com/urfave/cli/v2 v2.27.1
go.dedis.ch/debugtools v0.1.1
go.dedis.ch/kyber/v3 v3.1.0
go.etcd.io/bbolt v1.3.9
golang.org/x/crypto v0.31.0
golang.org/x/net v0.32.0
golang.org/x/net v0.33.0
golang.org/x/tools v0.28.0
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028
google.golang.org/grpc v1.70.0
Expand Down Expand Up @@ -66,7 +66,7 @@ require (
github.com/libp2p/go-netroute v0.2.2 // indirect
github.com/libp2p/go-reuseport v0.4.0 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/miekg/dns v1.1.62 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
Expand Down Expand Up @@ -106,7 +106,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.61.0 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.48.2 // indirect
Expand All @@ -130,7 +130,7 @@ require (
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.6.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
19 changes: 10 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk=
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
Expand Down Expand Up @@ -295,8 +296,8 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFSRQQ=
github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s=
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
Expand All @@ -312,8 +313,8 @@ github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
Expand Down Expand Up @@ -493,8 +494,8 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -541,8 +542,8 @@ golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
Expand Down
10 changes: 7 additions & 3 deletions internal/traffic/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ func GenerateItemsGraphviz(out io.Writer, withSend, withRcv bool, traffics ...*T

fmt.Fprintf(out, "digraph network_activity {\n")
fmt.Fprintf(out, "labelloc=\"t\";")
fmt.Fprintf(out, "label = <Network Diagram of %d nodes <font point-size='10'><br/>(generated %s)</font>>;", len(traffics), time.Now().Format("2 Jan 06 - 15:04:05"))
fmt.Fprintf(out, "label = <Network Diagram of %d nodes <font point-size='10'><br/>"+
"(generated %s)</font>>;", len(traffics), time.Now().Format("2 Jan 06 - 15:04:05"))
fmt.Fprintf(out, "graph [fontname = \"helvetica\"];")
fmt.Fprintf(out, "graph [fontname = \"helvetica\"];")
fmt.Fprintf(out, "node [fontname = \"helvetica\"];")
Expand Down Expand Up @@ -343,7 +344,8 @@ func GenerateItemsGraphviz(out io.Writer, withSend, withRcv bool, traffics ...*T
}

fmt.Fprintf(out, "\"%v\" -> \"%v\" "+
"[ label = < <font color='#303030'><b>%d</b> <font point-size='10'>(%d)</font></font><br/>%s> color=\"%s\" ];\n",
"[ label = < <font color='#303030'><b>%d</b> "+
"<font point-size='10'>(%d)</font></font><br/>%s> color=\"%s\" ];\n",
item.src, item.gateway, item.typeCounter, item.globalCounter, msgStr, color)
}
}
Expand All @@ -357,7 +359,9 @@ func GenerateEventGraphviz(out io.Writer, traffics ...*Traffic) {

fmt.Fprintf(out, "digraph network_activity {\n")
fmt.Fprintf(out, "labelloc=\"t\";")
fmt.Fprintf(out, "label = <Network Diagram of %d nodes <font point-size='10'><br/>(generated %s)</font>>;", len(traffics), time.Now().Format("2 Jan 06 - 15:04:05"))
fmt.Fprintf(out,
"label = <Network Diagram of %d nodes <font point-size='10'><br/>(generated %s)</font>>;",
len(traffics), time.Now().Format("2 Jan 06 - 15:04:05"))
fmt.Fprintf(out, "graph [fontname = \"helvetica\"];")
fmt.Fprintf(out, "graph [fontname = \"helvetica\"];")
fmt.Fprintf(out, "node [fontname = \"helvetica\"];")
Expand Down
Loading

0 comments on commit 659a9b6

Please sign in to comment.