Skip to content

ticker.Reset undefined (type *time.Ticker has no field or method Reset) #44858

@bo-er

Description

@bo-er

What version of Go are you using (go version)?

$ go version 1.15.6

Does this issue reproduce with the latest release?

I haven't test it in the latest version(1.16.0)

What operating system and processor architecture are you using (go env)?

$ go env

GOARCH="amd64"
GOBIN="/Users/steve/go/bin"
GOCACHE="/Users/steve/Library/Caches/go-build"
GOENV="/Users/steve/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/steve/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/steve/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5y/vj4hwy553y53q9hnqh21bnjr0000gn/T/go-build924144234=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I create a map to store tickers:

topicTickerMap = make(map[string]*time.Ticker)

And I put ticker into this map:

topicTickerMap[deviceIDAttributeName] = time.NewTicker(time.Duration(2*deviceAttribute.ScanTime) * time.Second)

And I reset this ticker using following code:

ticker, ok := topicTickerMap[deviceIDAttributeName]
if !ok {
return fmt.Errorf("Failed to get ticker:%v", ticker)
}
ticker.Reset(time.Duration(2*deviceAttribute.ScanTime) * time.Second)

The above code seems fine to me, and I can actually run my program without any complaining,
HOWEVER! whenever I run

docker build

I get this error like non-stop:

 ticker.Reset undefined (type *time.Ticker has no field or method Reset)

What did you expect to see?

I expect to see no error runing docker build, and it makes no sense to give this (type *time.Ticker has no field or method Reset) error, how come type *time.Ticker had no field or method Reset ??

What did you see instead?

I see the builder just made a complain about (type *time.Ticker has no field or method Reset)

Many thanks

I appreciate your time if you go this long to the end, thank you for your attention!

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions