Skip to content

Commit

Permalink
chore: ci: update go version (#5363)
Browse files Browse the repository at this point in the history
* chore: ci: update go version to 1.18

* chore: ci: update golangci-lint version to v1.50.0
  • Loading branch information
simlecode committed Oct 21, 2022
1 parent f1b8f96 commit f9be855
Show file tree
Hide file tree
Showing 76 changed files with 195 additions and 187 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/baisc_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18

- name: install deps
run: |
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.44.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.0
golangci-lint run --timeout 10m
- name: Compatible all
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/common_build_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18

- name: install deps
if: ${{ !inputs.has_ffi }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/common_go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18

- name: vars
id: vars
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.44.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.0
golangci-lint run --timeout 10m
- name: Detect changes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18

- name: install deps
run: |
Expand Down
2 changes: 1 addition & 1 deletion app/node/builder_getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (b builder) GenesisRoot() cid.Cid {
return b.genBlk.ParentStateRoot
}

//todo remove block time
// todo remove block time
// BlockTime get chain block time
func (b builder) BlockTime() time.Duration {
return b.blockTime
Expand Down
2 changes: 1 addition & 1 deletion app/submodule/chain/account_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type accountAPI struct {
chain *ChainSubmodule
}

//NewAccountAPI create a new account api
// NewAccountAPI create a new account api
func NewAccountAPI(chain *ChainSubmodule) v1api.IAccount {
return &accountAPI{chain: chain}
}
Expand Down
2 changes: 1 addition & 1 deletion app/submodule/chain/actor_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type actorAPI struct {
chain *ChainSubmodule
}

//NewActorAPI new actor api
// NewActorAPI new actor api
func NewActorAPI(chain *ChainSubmodule) v1api.IActor {
return &actorAPI{chain: chain}
}
Expand Down
4 changes: 2 additions & 2 deletions app/submodule/chain/chain_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ func (chain *ChainSubmodule) Start(ctx context.Context) error {
return chain.Fork.Start(ctx)
}

//Stop stop the chain head event
// Stop stop the chain head event
func (chain *ChainSubmodule) Stop(ctx context.Context) {
chain.ChainReader.Stop()
}

//API chain module api implement
// API chain module api implement
func (chain *ChainSubmodule) API() v1api.IChain {
return &chainAPI{
IAccount: NewAccountAPI(chain),
Expand Down
2 changes: 1 addition & 1 deletion app/submodule/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (s *ConfigModule) Get(dottedKey string) (interface{}, error) {
return s.repo.Config().Get(dottedKey)
}

//API create a new config api implement
// API create a new config api implement
func (s *ConfigModule) API() IConfig {
return &configAPI{config: s}
}
Expand Down
4 changes: 2 additions & 2 deletions app/submodule/mining/mining_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type MiningAPI struct { //nolint
Ming *MiningModule
}

//MinerGetBaseInfo get current miner information
// MinerGetBaseInfo get current miner information
func (miningAPI *MiningAPI) MinerGetBaseInfo(ctx context.Context, maddr address.Address, round abi.ChainEpoch, tsk types.TipSetKey) (*types.MiningBaseInfo, error) {
chainStore := miningAPI.Ming.ChainModule.ChainReader
ts, err := chainStore.GetTipSet(ctx, tsk)
Expand Down Expand Up @@ -146,7 +146,7 @@ func (miningAPI *MiningAPI) MinerGetBaseInfo(ctx context.Context, maddr address.
}, nil
}

//MinerCreateBlock create block base on template
// MinerCreateBlock create block base on template
func (miningAPI *MiningAPI) MinerCreateBlock(ctx context.Context, bt *types.BlockTemplate) (*types.BlockMsg, error) {
fblk, err := miningAPI.minerCreateBlock(ctx, bt)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions app/submodule/mining/mining_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type MiningModule struct { //nolint
Stmgr *statemanger.Stmgr
}

//API create new miningAPi implement
// API create new miningAPi implement
func (miningModule *MiningModule) API() v1api.IMining {
return &MiningAPI{Ming: miningModule}
}
Expand All @@ -39,7 +39,7 @@ func (miningModule *MiningModule) V0API() v0api.IMining {
return &MiningAPI{Ming: miningModule}
}

//NewMiningModule create new mining module
// NewMiningModule create new mining module
func NewMiningModule(
stmgr *statemanger.Stmgr,
conf miningConfig,
Expand Down
2 changes: 1 addition & 1 deletion app/submodule/multisig/multisig_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func NewMultiSigSubmodule(chainState v1api.IChain, msgPool v1api.IMessagePool, s
return &MultiSigSubmodule{state: chainState, mpool: msgPool, store: store}
}

//API create a new multisig implement
// API create a new multisig implement
func (sb *MultiSigSubmodule) API() v1api.IMultiSig {
return newMultiSig(sb)
}
Expand Down
4 changes: 2 additions & 2 deletions app/submodule/paych/paych_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1"
)

//PaychSubmodule support paych related functions, including paych construction, extraction, query and other functions
// PaychSubmodule support paych related functions, including paych construction, extraction, query and other functions
type PaychSubmodule struct { //nolint
pmgr *paychmgr.Manager
}
Expand All @@ -30,7 +30,7 @@ func (ps *PaychSubmodule) Stop() {
ps.pmgr.Stop()
}

//API create a new paych implement
// API create a new paych implement
func (ps *PaychSubmodule) API() v1api.IPaychan {
return NewPaychAPI(ps.pmgr)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func NewStorgeNetworkingSubmodule(ctx context.Context, network *network.NetworkS
}, nil
}

//API create a new storage implement
// API create a new storage implement
func (storageNetworking *StorageNetworkingSubmodule) API() IStorageNetworking {
return &storageNetworkingAPI{storageNetworking: storageNetworking}
}
Expand Down
2 changes: 1 addition & 1 deletion app/submodule/syncer/syncer_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (syncer *SyncerSubmodule) Stop(ctx context.Context) {
}
}

//API create a new sync api implement
// API create a new sync api implement
func (syncer *SyncerSubmodule) API() v1api.ISyncer {
return &syncerAPI{syncer: syncer}
}
Expand Down
2 changes: 1 addition & 1 deletion app/submodule/wallet/wallet_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func NewWalletSubmodule(ctx context.Context,
}, nil
}

//API create a new wallet api implement
// API create a new wallet api implement
func (wallet *WalletSubmodule) API() v1api.IWallet {
return &WalletAPI{
walletModule: wallet,
Expand Down
3 changes: 2 additions & 1 deletion cmd/tablewriter/tablewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ func NewLineCol(name string) Column {
}

// Unlike text/tabwriter, this works with CLI escape codes, and allows for info
// in separate lines
//
// in separate lines
func New(cols ...Column) *TableWriter {
return &TableWriter{
cols: cols,
Expand Down
4 changes: 2 additions & 2 deletions pkg/beacon/drand.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type DrandHTTPClient interface {
SetUserAgent(string)
}

//NewDrandBeacon create new beacon client from config, genesis block time and block delay
// NewDrandBeacon create new beacon client from config, genesis block time and block delay
func NewDrandBeacon(genTimeStamp, interval uint64, config cfg.DrandConf) (*DrandBeacon, error) {
drandChain, err := dchain.InfoFromJSON(bytes.NewReader([]byte(config.ChainInfoJSON)))
if err != nil {
Expand Down Expand Up @@ -103,7 +103,7 @@ func NewDrandBeacon(genTimeStamp, interval uint64, config cfg.DrandConf) (*Drand
return db, nil
}

//Entry get a beacon value of specify block height,
// Entry get a beacon value of specify block height,
func (db *DrandBeacon) Entry(ctx context.Context, round uint64) <-chan Response {
out := make(chan Response, 1)
if round != 0 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/beacon/drand_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//stm: ignore
//Only tests external library behavior, therefore it should not be annotated
// stm: ignore
// Only tests external library behavior, therefore it should not be annotated
package beacon

import (
Expand Down
4 changes: 2 additions & 2 deletions pkg/beacon/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

type Schedule []BeaconPoint

//BeaconForEpoch select beacon at specify epoch
// BeaconForEpoch select beacon at specify epoch
func (bs Schedule) BeaconForEpoch(e abi.ChainEpoch) RandomBeacon {
for i := len(bs) - 1; i >= 0; i-- {
bp := bs[i]
Expand All @@ -22,7 +22,7 @@ func (bs Schedule) BeaconForEpoch(e abi.ChainEpoch) RandomBeacon {
return bs[0].Beacon
}

//DrandConfigSchedule create new beacon schedule , used to select beacon server at specify chain height
// DrandConfigSchedule create new beacon schedule , used to select beacon server at specify chain height
func DrandConfigSchedule(genTimeStamp uint64, blockDelay uint64, drandSchedule map[abi.ChainEpoch]cfg.DrandEnum) (Schedule, error) {
shd := Schedule{}

Expand Down
6 changes: 3 additions & 3 deletions pkg/chain/chain_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

var DefaultChainIndexCacheSize = 32 << 10

//ChainIndex tipset height index, used to getting tipset by height quickly
// ChainIndex tipset height index, used to getting tipset by height quickly
type ChainIndex struct { //nolint
skipCache *lru.ARCCache

Expand All @@ -20,7 +20,7 @@ type ChainIndex struct { //nolint
skipLength abi.ChainEpoch
}

//NewChainIndex return a new chain index with arc cache
// NewChainIndex return a new chain index with arc cache
func NewChainIndex(lts loadTipSetFunc) *ChainIndex {
sc, _ := lru.NewARC(DefaultChainIndexCacheSize)
return &ChainIndex{
Expand Down Expand Up @@ -74,7 +74,7 @@ func (ci *ChainIndex) GetTipSetByHeight(ctx context.Context, from *types.TipSet,
}
}

//GetTipsetByHeightWithoutCache get the tipset of specific height by reading the database directly
// GetTipsetByHeightWithoutCache get the tipset of specific height by reading the database directly
func (ci *ChainIndex) GetTipsetByHeightWithoutCache(ctx context.Context, from *types.TipSet, to abi.ChainEpoch) (*types.TipSet, error) {
return ci.walkBack(ctx, from, to)
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/chain/circulating_supply.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type ICirculatingSupplyCalcualtor interface {
GetFilVested(ctx context.Context, height abi.ChainEpoch) (abi.TokenAmount, error)
}

//CirculatingSupplyCalculator used to calculate the funds at a specific block height
// CirculatingSupplyCalculator used to calculate the funds at a specific block height
type CirculatingSupplyCalculator struct {
bstore blockstoreutil.Blockstore
genesisRoot cid.Cid
Expand All @@ -47,12 +47,12 @@ type CirculatingSupplyCalculator struct {
upgradeConfig *config.ForkUpgradeConfig
}

//NewCirculatingSupplyCalculator create new circulating supply calculator
// NewCirculatingSupplyCalculator create new circulating supply calculator
func NewCirculatingSupplyCalculator(bstore blockstoreutil.Blockstore, genesisRoot cid.Cid, upgradeConfig *config.ForkUpgradeConfig) *CirculatingSupplyCalculator {
return &CirculatingSupplyCalculator{bstore: bstore, genesisRoot: genesisRoot, upgradeConfig: upgradeConfig}
}

//GetCirculatingSupplyDetailed query contract and calculate circulation status at specific height and tree state
// GetCirculatingSupplyDetailed query contract and calculate circulation status at specific height and tree state
func (caculator *CirculatingSupplyCalculator) GetCirculatingSupplyDetailed(ctx context.Context, height abi.ChainEpoch, st tree.Tree) (types.CirculatingSupply, error) {
filVested, err := caculator.GetFilVested(ctx, height)
if err != nil {
Expand Down Expand Up @@ -356,7 +356,7 @@ func (caculator *CirculatingSupplyCalculator) GetFilReserveDisbursed(ctx context
return big.Sub(big.NewFromGo(constants.InitialFilReserved), ract.Balance), nil
}

//GetFilMined query reward contract to get amount of mined fil
// GetFilMined query reward contract to get amount of mined fil
func GetFilMined(ctx context.Context, st tree.Tree) (abi.TokenAmount, error) {
ractor, found, err := st.GetActor(ctx, reward.Address)
if !found || err != nil {
Expand All @@ -371,7 +371,7 @@ func GetFilMined(ctx context.Context, st tree.Tree) (abi.TokenAmount, error) {
return rst.TotalStoragePowerReward()
}

//GetFilBurnt query burnt contract to get amount of burnt fil
// GetFilBurnt query burnt contract to get amount of burnt fil
func GetFilBurnt(ctx context.Context, st tree.Tree) (abi.TokenAmount, error) {
burnt, found, err := st.GetActor(ctx, builtin.BurntFundsActorAddr)
if !found || err != nil {
Expand All @@ -381,7 +381,7 @@ func GetFilBurnt(ctx context.Context, st tree.Tree) (abi.TokenAmount, error) {
return burnt.Balance, nil
}

//GetFilLocked query the market contract and power contract to get the amount of locked fils
// GetFilLocked query the market contract and power contract to get the amount of locked fils
func (caculator *CirculatingSupplyCalculator) GetFilLocked(ctx context.Context, st tree.Tree) (abi.TokenAmount, error) {

filMarketLocked, err := getFilMarketLocked(ctx, st)
Expand Down
13 changes: 9 additions & 4 deletions pkg/chain/coalescer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ import (

// WrapHeadChangeCoalescer wraps a ReorgNotifee with a head change coalescer.
// minDelay is the minimum coalesce delay; when a head change is first received, the coalescer will
// wait for that long to coalesce more head changes.
//
// wait for that long to coalesce more head changes.
//
// maxDelay is the maximum coalesce delay; the coalescer will not delay delivery of a head change
// more than that.
//
// more than that.
//
// mergeInterval is the interval that triggers additional coalesce delay; if the last head change was
// within the merge interval when the coalesce timer fires, then the coalesce time is extended
// by min delay and up to max delay total.
//
// within the merge interval when the coalesce timer fires, then the coalesce time is extended
// by min delay and up to max delay total.
func WrapHeadChangeCoalescer(fn ReorgNotifee, minDelay, maxDelay, mergeInterval time.Duration) ReorgNotifee {
c := NewHeadChangeCoalescer(fn, minDelay, maxDelay, mergeInterval)
return c.HeadChange
Expand Down
Loading

0 comments on commit f9be855

Please sign in to comment.