From 7ab2d355d56c7b6ec7cbfb22e3ba474616cff914 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Thu, 30 Aug 2018 20:20:15 -0400 Subject: [PATCH] some linting --- .gometalinter.json | 4 ++++ .travis.yml | 1 - cmd/dht.go | 6 +++--- dht/bits/bitmap.go | 4 ++-- reflector/stats.go | 6 +++--- 5 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 .gometalinter.json diff --git a/.gometalinter.json b/.gometalinter.json new file mode 100644 index 0000000..79a9e30 --- /dev/null +++ b/.gometalinter.json @@ -0,0 +1,4 @@ +{ + "Disable": ["golint"], + "Vendor": true +} diff --git a/.travis.yml b/.travis.yml index 2153602..4069cba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -93,4 +93,3 @@ deploy: secret_access_key: secure: "AxYRTy/GnjeTJKQdeJ/AEeAd+yXs783bFDKdyKNswtsHlU8sWPQgNcvTLpVqnSQMpiwkGDGi/70rvR5C+AT3SIWNw13RYrgBRpduQU0J+B2JS+3dN2DIePu25uvs++Wo22OfS8I+UjZ1mWY1SSHI2spPXvDCq5tb+Ih8nlYflEyAtxU9Oq2R3Kus2tkIlRnL25sP/2fY7RvuJFYIV63z8ZIJRzB5WzOeERqnXq2zfwos+hycAqyo/VevJnWAYTEDsvBuSODOpZF+QfKtIQ2rYSoqy8Lq1M6UOZimnC3Ulea4euBVf2ssBCnI7csGNG5UzkTiwrPDi2xIP8nM01rHW1yHJ7tQsJaghnUsfw2t6ui4ZofvbbOFTN/YCloHITifEi8Tc1/17isi3y+kX5yQ/Nk5UNry0Wbt91CP+nkL/ZmA5grkBXDL7VJMmB60TnO3ap24CtwBQartN3LoWs7h+4ov+LqbCt6IqpJVWQWlwJeb2MFPFByALtBpsqAyL1SxXlGNpPa94CuXxfQ6Bv436PtefA5FlTzR8uMmqsjWciv06bVnSvVlFEVovN2Fkplrjt7AASJ/8KJs4THDg4k61nfd8roAHx6ewQzl4wCWKCikQ0MuFd2mVHwdrbnCH1mIHuPRyvWMMIAK0ooc1/rmKiJlpgumjxoFYNE10MXtt+I=" bucket: "lbry-reflector-binary" -# local_dir: ./bin diff --git a/cmd/dht.go b/cmd/dht.go index d9064f5..18078c7 100644 --- a/cmd/dht.go +++ b/cmd/dht.go @@ -17,7 +17,7 @@ import ( var dhtNodeID string var dhtPort int -var dhtRpcPort int +var dhtRPCPort int var dhtSeeds []string func init() { @@ -30,7 +30,7 @@ func init() { } cmd.PersistentFlags().StringVar(&dhtNodeID, "nodeID", "", "nodeID in hex") cmd.PersistentFlags().IntVar(&dhtPort, "port", 4567, "Port to start DHT on") - cmd.PersistentFlags().IntVar(&dhtRpcPort, "rpcPort", 0, "Port to listen for rpc commands on") + cmd.PersistentFlags().IntVar(&dhtRPCPort, "rpcPort", 0, "Port to listen for rpc commands on") cmd.PersistentFlags().StringSliceVar(&dhtSeeds, "seeds", []string{}, "Addresses of seed nodes") rootCmd.AddCommand(cmd) } @@ -56,7 +56,7 @@ func dhtCmd(cmd *cobra.Command, args []string) { dhtConf := dht.NewStandardConfig() dhtConf.Address = "0.0.0.0:" + strconv.Itoa(dhtPort) - dhtConf.RPCPort = dhtRpcPort + dhtConf.RPCPort = dhtRPCPort if len(dhtSeeds) > 0 { dhtConf.SeedNodes = dhtSeeds } diff --git a/dht/bits/bitmap.go b/dht/bits/bitmap.go index 0605fb6..a711ff5 100644 --- a/dht/bits/bitmap.go +++ b/dht/bits/bitmap.go @@ -339,7 +339,7 @@ func FromBigP(b *big.Int) Bitmap { return FromShortHexP(b.Text(16)) } -// Max returns a bitmap with all bits set to 1 +// MaxP returns a bitmap with all bits set to 1 func MaxP() Bitmap { return FromHexP(strings.Repeat("f", NumBytes*2)) } @@ -383,7 +383,7 @@ func setBit(b []byte, n int, one bool) { } } -// CLosest returns the closest bitmap to target. if no bitmaps are provided, target itself is returned +// Closest returns the closest bitmap to target. if no bitmaps are provided, target itself is returned func Closest(target Bitmap, bitmaps ...Bitmap) Bitmap { if len(bitmaps) == 0 { return target diff --git a/reflector/stats.go b/reflector/stats.go index 39989d7..5331f94 100644 --- a/reflector/stats.go +++ b/reflector/stats.go @@ -48,12 +48,12 @@ func (s *stats) Shutdown() { func (s *stats) AddBlob() { s.mu.Lock() defer s.mu.Unlock() - s.blobs += 1 + s.blobs++ } func (s *stats) AddStream() { s.mu.Lock() defer s.mu.Unlock() - s.streams += 1 + s.streams++ } func (s *stats) AddError(e error) (shouldLog bool) { // shouldLog is a hack, but whataever @@ -71,7 +71,7 @@ func (s *stats) AddError(e error) (shouldLog bool) { // shouldLog is a hack, but shouldLog = true s.mu.Lock() defer s.mu.Unlock() - s.errors[name] += 1 + s.errors[name]++ return }