tklauser / go-sysconf

sysconf for Go, without using cgo
https://pkg.go.dev/github.com/tklauser/go-sysconf
BSD 3-Clause "New" or "Revised" License
141 stars 27 forks source link

Trivial documentation bug in README.md #3

Closed tomparkin closed 4 years ago

tomparkin commented 4 years ago

README.md has the following example:

func main() {
    // get clock ticks, this will return the same as C.sysconf(C._SC_CLK_TCK)
    clktck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
    if err != nil {
        fmt.Printf("SC_CLK_TCK: %v\n", clktck)
    }
}

I think the if block should execute if there is no error, i.e. if err == nil.

Currently the example is printing the value of clktck if an error occurred.

tklauser commented 4 years ago

Thanks! Pushed 92513908778978c545cdfac50d0864e266f61622 with a fix.