Skip to content

Commit

Permalink
resolve some linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
robdefeo committed Oct 24, 2019
1 parent 2788492 commit b941e98
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 41 deletions.
7 changes: 5 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ linters-settings:
- style
- experimental
disabled-checks:
- wrapperFunc
- wrapperFunc
golangci-lint-version: 1.16.x
linters:
presets:
Expand All @@ -84,7 +84,10 @@ linters:
- complexity
- format
- performance
- style
- style
disable:
- govet
- lll

# service:
# prepare:
Expand Down
1 change: 1 addition & 0 deletions cmd/mailchain/internal/http/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type config struct {
sentStore stores.Sent
}

// nolint: gocyclo
func produceConfig(s *settings.Base) (*config, error) {
mailboxStore, err := s.MailboxState.Produce()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/mailchain/internal/http/handlers/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/pkg/errors"
)

// nolint: gocyclo
// GetMessages returns a handler get spec
func GetMessages(inbox stores.State, receivers map[string]mailbox.Receiver, ks keystore.Store,
deriveKeyOptions multi.OptionsBuilders) func(w http.ResponseWriter, r *http.Request) {
Expand Down
1 change: 1 addition & 0 deletions cmd/mailchain/internal/settings/nameservice_address.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// nolint: dupl
package settings

import (
Expand Down
1 change: 1 addition & 0 deletions cmd/mailchain/internal/settings/nameservice_domain.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// nolint: dupl
package settings

import (
Expand Down
10 changes: 5 additions & 5 deletions cmd/mailchain/internal/settings/sentstore_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ func (s SentStoreS3) Produce() (*s3store.Sent, error) {
return s3store.NewSent(s.Region.Get(), s.Bucket.Get(), s.AccessKeyID.Get(), s.SecretAccessKey.Get())
}

func (ss SentStoreS3) Output() output.Element {
func (s SentStoreS3) Output() output.Element {
return output.Element{
FullName: "sentstore.s3",
Attributes: []output.Attribute{
ss.Bucket.Attribute(),
ss.Region.Attribute(),
ss.AccessKeyID.Attribute(),
ss.SecretAccessKey.Attribute(),
s.Bucket.Attribute(),
s.Region.Attribute(),
s.AccessKeyID.Attribute(),
s.SecretAccessKey.Attribute(),
},
}
}
10 changes: 6 additions & 4 deletions crypto/ed25519/ed25519test/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ package ed25519test

import (
"log"

"github.com/mailchain/mailchain/crypto"
"github.com/mailchain/mailchain/crypto/ed25519"
"github.com/mailchain/mailchain/internal/testutil"
)

var SofiaPrivateKey crypto.PrivateKey
var SofiaPublicKey crypto.PublicKey
var CharlottePrivateKey crypto.PrivateKey
var CharlottePublicKey crypto.PublicKey
var SofiaPrivateKey crypto.PrivateKey // nolint: gochecknoglobals
var SofiaPublicKey crypto.PublicKey // nolint: gochecknoglobals
var CharlottePrivateKey crypto.PrivateKey // nolint: gochecknoglobals
var CharlottePublicKey crypto.PublicKey // nolint: gochecknoglobals

// nolint: gochecknoinits
func init() {
var err error
SofiaPrivateKey, err = ed25519.PrivateKeyFromSeed(testutil.MustHexDecodeString("0d9b4a3c10721991c6b806f0f343535dc2b46c74bece50a0a0d6b9f0070d3157"))
Expand Down
2 changes: 1 addition & 1 deletion crypto/multikey/chain_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
package multikey

import (
"github.com/mailchain/mailchain/internal/protocols"
"github.com/mailchain/mailchain/internal/encoding"
"github.com/mailchain/mailchain/internal/protocols"
"github.com/pkg/errors"
)

Expand Down
9 changes: 5 additions & 4 deletions crypto/secp256k1/secp256k1test/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"github.com/mailchain/mailchain/crypto/secp256k1"
)

var SofiaPrivateKey crypto.PrivateKey
var SofiaPublicKey crypto.PublicKey
var CharlottePrivateKey crypto.PrivateKey
var CharlottePublicKey crypto.PublicKey
var SofiaPrivateKey crypto.PrivateKey // nolint: gochecknoglobals
var SofiaPublicKey crypto.PublicKey // nolint: gochecknoglobals
var CharlottePrivateKey crypto.PrivateKey // nolint: gochecknoglobals
var CharlottePublicKey crypto.PublicKey // nolint: gochecknoglobals

// nolint: gochecknoinits
func init() {
var err error
SofiaPrivateKey, err = secp256k1.PrivateKeyFromHex("01901E63389EF02EAA7C5782E08B40D98FAEF835F28BD144EECF5614A415943F")
Expand Down
6 changes: 3 additions & 3 deletions internal/mailbox/signer/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package signer

// Signer return a signed transaction
type Signer interface {
Sign(opts SignerOpts) (signedTransaction interface{}, err error)
Sign(opts Options) (signedTransaction interface{}, err error)
}

// SignerOpts options related to different signers
type SignerOpts interface{}
// Options options related to different signers
type Options interface{}
24 changes: 12 additions & 12 deletions internal/mailbox/signer/signertest/signer_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/protocols/ethereum/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type Signer struct {
privateKey crypto.PrivateKey
}

func (e Signer) Sign(opts signer.SignerOpts) (signedTransaction interface{}, err error) {
func (e Signer) Sign(opts signer.Options) (signedTransaction interface{}, err error) {
if opts == nil {
return nil, errors.New("opts must not be nil")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/protocols/ethereum/signer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestSigner_Sign(t *testing.T) {
privateKey crypto.PrivateKey
}
type args struct {
opts signer.SignerOpts
opts signer.Options
}
tests := []struct {
name string
Expand Down
9 changes: 5 additions & 4 deletions internal/testutil/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import (
"github.com/mailchain/mailchain/crypto/secp256k1"
)

var SofiaPrivateKey crypto.PrivateKey
var SofiaPublicKey crypto.PublicKey
var CharlottePrivateKey crypto.PrivateKey
var CharlottePublicKey crypto.PublicKey
var SofiaPrivateKey crypto.PrivateKey // nolint: gochecknoglobals
var SofiaPublicKey crypto.PublicKey // nolint: gochecknoglobals
var CharlottePrivateKey crypto.PrivateKey // nolint: gochecknoglobals
var CharlottePublicKey crypto.PublicKey // nolint: gochecknoglobals

// nolint: gochecknoinits
func init() {
var err error
SofiaPrivateKey, err = secp256k1.PrivateKeyFromHex("01901E63389EF02EAA7C5782E08B40D98FAEF835F28BD144EECF5614A415943F")
Expand Down
2 changes: 1 addition & 1 deletion nameservice/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const (
couldNotParseAddressErrorMsg = "could not parse address"
)

// RFC 1035 error interpretation
var (
// RFC 1035 error interpretation
ErrFormat = errors.New("Format Error")
ErrServFail = errors.New("Server Failure")
ErrNXDomain = errors.New("Non-Existent Domain")
Expand Down
2 changes: 1 addition & 1 deletion sender/ethrpc2/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
geth "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/mailchain/mailchain/internal/protocols/ethereum"
"github.com/mailchain/mailchain/internal/mailbox/signer"
"github.com/mailchain/mailchain/internal/protocols/ethereum"
"github.com/mailchain/mailchain/sender"
"github.com/pkg/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion sender/ethrpc2/sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/golang/mock/gomock"
"github.com/mailchain/mailchain/internal/protocols/ethereum"
"github.com/mailchain/mailchain/internal/mailbox/signer"
"github.com/mailchain/mailchain/internal/mailbox/signer/signertest"
"github.com/mailchain/mailchain/internal/protocols/ethereum"
"github.com/mailchain/mailchain/internal/testutil"
"github.com/mailchain/mailchain/sender"
"github.com/mailchain/mailchain/sender/ethrpc2/ethrpc2test"
Expand Down
2 changes: 1 addition & 1 deletion sender/relay/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"
"strings"

"github.com/mailchain/mailchain/internal/mailbox/signer"
"github.com/mailchain/mailchain/internal/protocols"
"github.com/mailchain/mailchain/internal/protocols/ethereum"
"github.com/mailchain/mailchain/internal/mailbox/signer"
"github.com/mailchain/mailchain/sender"
"github.com/mailchain/mailchain/sender/ethrpc2"
"github.com/pkg/errors"
Expand Down

0 comments on commit b941e98

Please sign in to comment.