FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
github-release/util.go at master · github-release/github-release · GitHub
github-release
github-release
Repository navigation
Code
Issues
27
(27)
Pull requests
6
(6)
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
github-release
/
util.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (43 loc) · 905 Bytes
Breadcrumbs
github-release
/
util.go
Copy path
File metadata and controls
52 lines (43 loc) · 905 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
46
47
48
49
50
51
52
package
main
import
(
"fmt"
"os"
"time"
)
/* nvls returns the first value in xs that is not empty. */
func
nvls
(
xs
...
string
)
string
{
for
_
,
s
:=
range
xs
{
if
s
!=
""
{
return
s
}
}
return
""
}
func
vprintln
(
a
...
interface
{}) (
int
,
error
) {
if
VERBOSITY
>
0
{
return
fmt
.
Fprintln
(
os
.
Stderr
,
a
...
)
}
return
0
,
nil
}
func
vprintf
(
format
string
,
a
...
interface
{}) (
int
,
error
) {
if
VERBOSITY
>
0
{
return
fmt
.
Fprintf
(
os
.
Stderr
,
format
,
a
...
)
}
return
0
,
nil
}
// formats time `t` as `fmt` if it is not nil, otherwise returns `def`
func
timeFmtOr
(
t
*
time.
Time
,
fmt
,
def
string
)
string
{
if
t
==
nil
{
return
def
}
return
t
.
Format
(
fmt
)
}
// isCharDevice returns true if f is a character device (panics if f can't
// be stat'ed).
func
isCharDevice
(
f
*
os.
File
)
bool
{
stat
,
err
:=
f
.
Stat
()
if
err
!=
nil
{
panic
(
err
)
}
return
(
stat
.
Mode
()
&
os
.
ModeCharDevice
)
!=
0
}
Back
|
FazBrowse Home
|
New Git URL