get.porter.sh/porter@v1.3.0/pkg/version.go (about) 1 package pkg 2 3 import "os" 4 5 // These are build-time values, set during an official release 6 var ( 7 Commit string 8 Version string 9 ) 10 11 const ( 12 // FileModeDirectory is the FileMode that should be used when creating a 13 // directory. It ensures that both the user and the group have the same 14 // permissions. 15 FileModeDirectory os.FileMode = 0770 16 17 // FileModeWritable is the FileMode that should be used when creating a file 18 // that should have read/write permissions. It ensures that both the user and 19 // the group have the same permissions. 20 FileModeWritable os.FileMode = 0660 21 22 // FileModeExecutable is the FileMode that should be used when creating an 23 // executable file, such as a script or binary. It ensures that both the user 24 // and the group have the same permissions. 25 FileModeExecutable os.FileMode = 0770 26 27 // PORTER_USER_AGENT is the value used in user-agent header for porter 28 PORTER_USER_AGENT = "getporter/porter" 29 ) 30 31 // UserAgent returns a string that can be used as a user agent for porter. 32 func UserAgent() string { 33 product := PORTER_USER_AGENT 34 35 if Commit == "" && Version == "" { 36 return product 37 } 38 39 v := Version 40 if v == "" { 41 v = Commit 42 } 43 44 return product + "/" + v 45 }