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