...

Source file src/github.com/tklauser/go-sysconf/example_test.go

Documentation: github.com/tklauser/go-sysconf

     1  // Copyright 2018 Tobias Klauser. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
     6  // +build darwin dragonfly freebsd linux netbsd openbsd solaris
     7  
     8  package sysconf_test
     9  
    10  import (
    11  	"fmt"
    12  	"os"
    13  
    14  	"github.com/tklauser/go-sysconf"
    15  )
    16  
    17  func ExampleSysconf_clktck() {
    18  	clktck, err := sysconf.Sysconf(sysconf.SC_CLK_TCK)
    19  	if err != nil {
    20  		fmt.Fprintf(os.Stderr, "Sysconf: %v\n", err)
    21  	}
    22  	fmt.Printf("sysconf(SC_CLK_TCK) = %v\n", clktck)
    23  }
    24  
    25  func ExampleSysconf_invalidParameter() {
    26  	_, err := sysconf.Sysconf(-1)
    27  	fmt.Print(err)
    28  
    29  	// Output: invalid parameter value
    30  }
    31  

View as plain text