Skip to content

Commit

Permalink
added golint to the ci
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph committed Oct 9, 2020
1 parent a10a50e commit 92d9ea8
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 115 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ linters:
- gocritic
- gofmt
- goimports
- golint
- gosec
- gosimple
- govet
Expand All @@ -20,7 +21,6 @@ linters:
- nakedret
- unconvert
- varcheck
# - golint
# - lll
# - gocyclo
# - gomnd
Expand Down
34 changes: 17 additions & 17 deletions api/common_args_responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type SuccessResponse struct {
Success bool `json:"success"`
}

// JsonTxID contains the ID of a transaction
type JsonTxID struct {
// JSONTxID contains the ID of a transaction
type JSONTxID struct {
TxID ids.ID `json:"txID"`
}

Expand All @@ -20,38 +20,38 @@ type UserPass struct {
Password string `json:"password"`
}

// JsonAddress contains an address
type JsonAddress struct {
// JSONAddress contains an address
type JSONAddress struct {
Address string `json:"address"`
}

// JsonAddresses contains a list of address
type JsonAddresses struct {
// JSONAddresses contains a list of address
type JSONAddresses struct {
Addresses []string `json:"addresses"`
}

// ChangeAddr is the address change is sent to, if any
type JsonChangeAddr struct {
type JSONChangeAddr struct {
ChangeAddr string `json:"changeAddr"`
}

// JsonTxIDChangeAddr is a tx ID and change address
type JsonTxIDChangeAddr struct {
JsonTxID
JsonChangeAddr
// JSONTxIDChangeAddr is a tx ID and change address
type JSONTxIDChangeAddr struct {
JSONTxID
JSONChangeAddr
}

// JsonFromAddrs is a list of addresses to send funds from
type JsonFromAddrs struct {
// JSONFromAddrs is a list of addresses to send funds from
type JSONFromAddrs struct {
From []string `json:"from"`
}

// JsonSpendHeader is 3 arguments to a method that spends (including those with tx fees)
// JSONSpendHeader is 3 arguments to a method that spends (including those with tx fees)
// 1) The username/password
// 2) The addresses used in the method
// 3) The address to send change to
type JsonSpendHeader struct {
type JSONSpendHeader struct {
UserPass
JsonFromAddrs
JsonChangeAddr
JSONFromAddrs
JSONChangeAddr
}
54 changes: 27 additions & 27 deletions vms/avm/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type FormattedAssetID struct {
}

// IssueTx attempts to issue a transaction into consensus
func (service *Service) IssueTx(r *http.Request, args *FormattedTx, reply *api.JsonTxID) error {
func (service *Service) IssueTx(r *http.Request, args *FormattedTx, reply *api.JSONTxID) error {
service.vm.ctx.Log.Info("AVM: IssueTx called with %s", args.Tx)

txID, err := service.vm.IssueTx(args.Tx.Bytes)
Expand All @@ -81,7 +81,7 @@ type GetTxStatusReply struct {
}

// GetTxStatus returns the status of the specified transaction
func (service *Service) GetTxStatus(r *http.Request, args *api.JsonTxID, reply *GetTxStatusReply) error {
func (service *Service) GetTxStatus(r *http.Request, args *api.JSONTxID, reply *GetTxStatusReply) error {
service.vm.ctx.Log.Info("AVM: GetTxStatus called with %s", args.TxID)

if args.TxID.IsZero() {
Expand All @@ -98,7 +98,7 @@ func (service *Service) GetTxStatus(r *http.Request, args *api.JsonTxID, reply *
}

// GetTx returns the specified transaction
func (service *Service) GetTx(r *http.Request, args *api.JsonTxID, reply *FormattedTx) error {
func (service *Service) GetTx(r *http.Request, args *api.JSONTxID, reply *FormattedTx) error {
service.vm.ctx.Log.Info("AVM: GetTx called with %s", args.TxID)

if args.TxID.IsZero() {
Expand Down Expand Up @@ -360,7 +360,7 @@ type GetAllBalancesReply struct {
// Value: The balance of the asset held by the address
// Note that balances include assets that the address only _partially_ owns
// (ie is one of several addresses specified in a multi-sig)
func (service *Service) GetAllBalances(r *http.Request, args *api.JsonAddress, reply *GetAllBalancesReply) error {
func (service *Service) GetAllBalances(r *http.Request, args *api.JSONAddress, reply *GetAllBalancesReply) error {
service.vm.ctx.Log.Info("AVM: GetAllBalances called with address: %s", args.Address)

address, err := service.vm.ParseLocalAddress(args.Address)
Expand Down Expand Up @@ -413,7 +413,7 @@ func (service *Service) GetAllBalances(r *http.Request, args *api.JsonAddress, r

// CreateFixedCapAssetArgs are arguments for passing into CreateFixedCapAsset requests
type CreateFixedCapAssetArgs struct {
api.JsonSpendHeader // User, password, from addrs, change addr
api.JSONSpendHeader // User, password, from addrs, change addr
Name string `json:"name"`
Symbol string `json:"symbol"`
Denomination byte `json:"denomination"`
Expand All @@ -429,7 +429,7 @@ type Holder struct {
// AssetIDChangeAddr is an asset ID and a change address
type AssetIDChangeAddr struct {
FormattedAssetID
api.JsonChangeAddr
api.JSONChangeAddr
}

// CreateFixedCapAsset returns ID of the newly created asset
Expand Down Expand Up @@ -543,7 +543,7 @@ func (service *Service) CreateFixedCapAsset(r *http.Request, args *CreateFixedCa

// CreateVariableCapAssetArgs are arguments for passing into CreateVariableCapAsset requests
type CreateVariableCapAssetArgs struct {
api.JsonSpendHeader // User, password, from addrs, change addr
api.JSONSpendHeader // User, password, from addrs, change addr
Name string `json:"name"`
Symbol string `json:"symbol"`
Denomination byte `json:"denomination"`
Expand Down Expand Up @@ -671,7 +671,7 @@ func (service *Service) CreateVariableCapAsset(r *http.Request, args *CreateVari

// CreateNFTAssetArgs are arguments for passing into CreateNFTAsset requests
type CreateNFTAssetArgs struct {
api.JsonSpendHeader // User, password, from addrs, change addr
api.JSONSpendHeader // User, password, from addrs, change addr
Name string `json:"name"`
Symbol string `json:"symbol"`
MinterSets []Owners `json:"minterSets"`
Expand Down Expand Up @@ -791,7 +791,7 @@ func (service *Service) CreateNFTAsset(r *http.Request, args *CreateNFTAssetArgs
}

// CreateAddress creates an address for the user [args.Username]
func (service *Service) CreateAddress(r *http.Request, args *api.UserPass, reply *api.JsonAddress) error {
func (service *Service) CreateAddress(r *http.Request, args *api.UserPass, reply *api.JSONAddress) error {
service.vm.ctx.Log.Info("AVM: CreateAddress called for user '%s'", args.Username)

db, err := service.vm.ctx.Keystore.GetDatabase(args.Username, args.Password)
Expand Down Expand Up @@ -836,7 +836,7 @@ func (service *Service) CreateAddress(r *http.Request, args *api.UserPass, reply
}

// ListAddresses returns all of the addresses controlled by user [args.Username]
func (service *Service) ListAddresses(_ *http.Request, args *api.UserPass, response *api.JsonAddresses) error {
func (service *Service) ListAddresses(_ *http.Request, args *api.UserPass, response *api.JSONAddresses) error {
service.vm.ctx.Log.Info("AVM: ListAddresses called for user '%s'", args.Username)

db, err := service.vm.ctx.Keystore.GetDatabase(args.Username, args.Password)
Expand Down Expand Up @@ -918,7 +918,7 @@ type ImportKeyReply struct {
}

// ImportKey adds a private key to the provided user
func (service *Service) ImportKey(r *http.Request, args *ImportKeyArgs, reply *api.JsonAddress) error {
func (service *Service) ImportKey(r *http.Request, args *ImportKeyArgs, reply *api.JSONAddress) error {
service.vm.ctx.Log.Info("AVM: ImportKey called for user '%s'", args.Username)

db, err := service.vm.ctx.Keystore.GetDatabase(args.Username, args.Password)
Expand Down Expand Up @@ -991,7 +991,7 @@ type SendOutput struct {
// SendArgs are arguments for passing into Send requests
type SendArgs struct {
// User, password, from addrs, change addr
api.JsonSpendHeader
api.JSONSpendHeader

// The amount, assetID, and destination to send funds to
SendOutput
Expand All @@ -1008,7 +1008,7 @@ type SendArgs struct {
// SendMultipleArgs are arguments for passing into SendMultiple requests
type SendMultipleArgs struct {
// User, password, from addrs, change addr
api.JsonSpendHeader
api.JSONSpendHeader

// The outputs of the transaction
Outputs []SendOutput `json:"outputs"`
Expand All @@ -1023,17 +1023,17 @@ type SendMultipleArgs struct {
}

// Send returns the ID of the newly created transaction
func (service *Service) Send(r *http.Request, args *SendArgs, reply *api.JsonTxIDChangeAddr) error {
func (service *Service) Send(r *http.Request, args *SendArgs, reply *api.JSONTxIDChangeAddr) error {
return service.SendMultiple(r, &SendMultipleArgs{
JsonSpendHeader: args.JsonSpendHeader,
JSONSpendHeader: args.JSONSpendHeader,
Outputs: []SendOutput{args.SendOutput},
From: args.From,
Memo: args.Memo,
}, reply)
}

// SendMultiple sends a transaction with multiple outputs.
func (service *Service) SendMultiple(r *http.Request, args *SendMultipleArgs, reply *api.JsonTxIDChangeAddr) error {
func (service *Service) SendMultiple(r *http.Request, args *SendMultipleArgs, reply *api.JSONTxIDChangeAddr) error {
service.vm.ctx.Log.Info("AVM: Send called with username: %s", args.Username)

// Validate the memo field
Expand Down Expand Up @@ -1181,14 +1181,14 @@ func (service *Service) SendMultiple(r *http.Request, args *SendMultipleArgs, re

// MintArgs are arguments for passing into Mint requests
type MintArgs struct {
api.JsonSpendHeader // User, password, from addrs, change addr
api.JSONSpendHeader // User, password, from addrs, change addr
Amount json.Uint64 `json:"amount"`
AssetID string `json:"assetID"`
To string `json:"to"`
}

// Mint issues a transaction that mints more of the asset
func (service *Service) Mint(r *http.Request, args *MintArgs, reply *api.JsonTxIDChangeAddr) error {
func (service *Service) Mint(r *http.Request, args *MintArgs, reply *api.JSONTxIDChangeAddr) error {
service.vm.ctx.Log.Info("AVM: Mint called with username: %s", args.Username)

if args.Amount == 0 {
Expand Down Expand Up @@ -1301,14 +1301,14 @@ func (service *Service) Mint(r *http.Request, args *MintArgs, reply *api.JsonTxI

// SendNFTArgs are arguments for passing into SendNFT requests
type SendNFTArgs struct {
api.JsonSpendHeader // User, password, from addrs, change addr
api.JSONSpendHeader // User, password, from addrs, change addr
AssetID string `json:"assetID"`
GroupID json.Uint32 `json:"groupID"`
To string `json:"to"`
}

// SendNFT sends an NFT
func (service *Service) SendNFT(r *http.Request, args *SendNFTArgs, reply *api.JsonTxIDChangeAddr) error {
func (service *Service) SendNFT(r *http.Request, args *SendNFTArgs, reply *api.JSONTxIDChangeAddr) error {
service.vm.ctx.Log.Info("AVM: SendNFT called with username: %s", args.Username)

// Parse the asset ID
Expand Down Expand Up @@ -1414,14 +1414,14 @@ func (service *Service) SendNFT(r *http.Request, args *SendNFTArgs, reply *api.J

// MintNFTArgs are arguments for passing into MintNFT requests
type MintNFTArgs struct {
api.JsonSpendHeader // User, password, from addrs, change addr
api.JSONSpendHeader // User, password, from addrs, change addr
AssetID string `json:"assetID"`
Payload formatting.CB58 `json:"payload"`
To string `json:"to"`
}

// MintNFT issues a MintNFT transaction and returns the ID of the newly created transaction
func (service *Service) MintNFT(r *http.Request, args *MintNFTArgs, reply *api.JsonTxIDChangeAddr) error {
func (service *Service) MintNFT(r *http.Request, args *MintNFTArgs, reply *api.JSONTxIDChangeAddr) error {
service.vm.ctx.Log.Info("AVM: MintNFT called with username: %s", args.Username)

assetID, err := service.lookupAssetID(args.AssetID)
Expand Down Expand Up @@ -1542,14 +1542,14 @@ type ImportArgs struct {
}

// ImportAVAX is a deprecated name for Import.
func (service *Service) ImportAVAX(_ *http.Request, args *ImportArgs, reply *api.JsonTxID) error {
func (service *Service) ImportAVAX(_ *http.Request, args *ImportArgs, reply *api.JSONTxID) error {
return service.Import(nil, args, reply)
}

// Import imports an asset to this chain from the P/C-Chain.
// The AVAX must have already been exported from the P/C-Chain.
// Returns the ID of the newly created atomic transaction
func (service *Service) Import(_ *http.Request, args *ImportArgs, reply *api.JsonTxID) error {
func (service *Service) Import(_ *http.Request, args *ImportArgs, reply *api.JSONTxID) error {
service.vm.ctx.Log.Info("AVM: Import called with username: %s", args.Username)

chainID, err := service.vm.ctx.BCLookup.Lookup(args.SourceChain)
Expand Down Expand Up @@ -1653,7 +1653,7 @@ func (service *Service) Import(_ *http.Request, args *ImportArgs, reply *api.Jso
// ExportAVAXArgs are arguments for passing into ExportAVA requests
type ExportAVAXArgs struct {
// User, password, from addrs, change addr
api.JsonSpendHeader
api.JSONSpendHeader
// Amount of nAVAX to send
Amount json.Uint64 `json:"amount"`

Expand All @@ -1665,7 +1665,7 @@ type ExportAVAXArgs struct {
// ExportAVAX sends AVAX from this chain to the P-Chain.
// After this tx is accepted, the AVAX must be imported to the P-chain with an importTx.
// Returns the ID of the newly created atomic transaction
func (service *Service) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, reply *api.JsonTxIDChangeAddr) error {
func (service *Service) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, reply *api.JSONTxIDChangeAddr) error {
return service.Export(nil, &ExportArgs{
ExportAVAXArgs: *args,
AssetID: service.vm.ctx.AVAXAssetID.String(),
Expand All @@ -1681,7 +1681,7 @@ type ExportArgs struct {
// Export sends an asset from this chain to the P/C-Chain.
// After this tx is accepted, the AVAX must be imported to the P/C-chain with an importTx.
// Returns the ID of the newly created atomic transaction
func (service *Service) Export(_ *http.Request, args *ExportArgs, reply *api.JsonTxIDChangeAddr) error {
func (service *Service) Export(_ *http.Request, args *ExportArgs, reply *api.JSONTxIDChangeAddr) error {
service.vm.ctx.Log.Info("AVM: Export called with username: %s", args.Username)

// Parse the asset ID
Expand Down
Loading

0 comments on commit 92d9ea8

Please sign in to comment.