git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/sysinfo/example_test.go (about)

     1  // Copyright © 2016 Zlatko Čalušić
     2  //
     3  // Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.
     4  
     5  package sysinfo_test
     6  
     7  import (
     8  	"encoding/json"
     9  	"fmt"
    10  	"log"
    11  	"testing"
    12  
    13  	"git.sr.ht/~pingoo/stdx/sysinfo"
    14  )
    15  
    16  func Test(t *testing.T) {
    17  	var si sysinfo.SysInfo
    18  
    19  	si.GetSysInfo()
    20  
    21  	data, err := json.MarshalIndent(&si, "", "  ")
    22  	if err != nil {
    23  		log.Fatal(err)
    24  	}
    25  
    26  	fmt.Println(string(data))
    27  }