pkg.re/essentialkaos/ek.10@v12.41.0+incompatible/system/procname/examples_test.go (about) 1 package procname 2 3 // ////////////////////////////////////////////////////////////////////////////////// // 4 // // 5 // Copyright (c) 2022 ESSENTIAL KAOS // 6 // Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> // 7 // // 8 // ////////////////////////////////////////////////////////////////////////////////// // 9 10 import ( 11 "fmt" 12 "os" 13 "strings" 14 ) 15 16 // ////////////////////////////////////////////////////////////////////////////////// // 17 18 func ExampleSet() { 19 args := os.Args 20 21 // Mask first argument 22 args[1] = strings.Repeat("*", len(args[1])) 23 24 err := Set(args) 25 26 if err != nil { 27 fmt.Printf("Error: %v\n", err) 28 } 29 } 30 31 func ExampleReplace() { 32 password := "mySuppaPass" 33 34 // Replacing known password to asterisks 35 err := Replace(password, "*****************") 36 37 if err != nil { 38 fmt.Printf("Error: %v\n", err) 39 } 40 }