Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b6512a44
Commit
b6512a44
authored
Sep 24, 2015
by
Brian Grant
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13835 from liggitt/assetfs
bump(github.com/elazarl/go-bindata-assetfs): 3dcc96556217539f50599357fb481ac0dc7439b9
parents
45cf5636
b546045c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
8 deletions
+43
-8
Godeps.json
Godeps/Godeps.json
+1
-1
assetfs.go
...pace/src/github.com/elazarl/go-bindata-assetfs/assetfs.go
+4
-4
main.go
...com/elazarl/go-bindata-assetfs/go-bindata-assetfs/main.go
+38
-3
No files found.
Godeps/Godeps.json
View file @
b6512a44
...
...
@@ -211,7 +211,7 @@
},
{
"ImportPath"
:
"github.com/elazarl/go-bindata-assetfs"
,
"Rev"
:
"
c57a80f1ab2ad67bafa83f5fd0b4c2ecbd253dd5
"
"Rev"
:
"
3dcc96556217539f50599357fb481ac0dc7439b9
"
},
{
"ImportPath"
:
"github.com/emicklei/go-restful"
,
...
...
Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/assetfs.go
View file @
b6512a44
...
...
@@ -136,12 +136,12 @@ func (fs *AssetFS) Open(name string) (http.File, error) {
if
len
(
name
)
>
0
&&
name
[
0
]
==
'/'
{
name
=
name
[
1
:
]
}
if
b
,
err
:=
fs
.
Asset
(
name
);
err
==
nil
{
return
NewAssetFile
(
name
,
b
),
nil
}
if
children
,
err
:=
fs
.
AssetDir
(
name
);
err
==
nil
{
return
NewAssetDirectory
(
name
,
children
,
fs
),
nil
}
b
,
err
:=
fs
.
Asset
(
name
)
if
err
!=
nil
{
}
else
{
return
nil
,
err
}
return
NewAssetFile
(
name
,
b
),
nil
}
Godeps/_workspace/src/github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs/main.go
View file @
b6512a44
...
...
@@ -3,13 +3,31 @@ package main
import
(
"bufio"
"bytes"
"flag"
"fmt"
"os"
"os/exec"
"strings"
)
const
bindatafile
=
"bindata.go"
func
isDebug
(
args
[]
string
)
bool
{
flagset
:=
flag
.
NewFlagSet
(
""
,
flag
.
ContinueOnError
)
debug
:=
flagset
.
Bool
(
"debug"
,
false
,
""
)
debugArgs
:=
make
([]
string
,
0
)
for
_
,
arg
:=
range
args
{
if
strings
.
HasPrefix
(
arg
,
"-debug"
)
{
debugArgs
=
append
(
debugArgs
,
arg
)
}
}
flagset
.
Parse
(
debugArgs
)
if
debug
==
nil
{
return
false
}
return
*
debug
}
func
main
()
{
if
_
,
err
:=
exec
.
LookPath
(
"go-bindata"
);
err
!=
nil
{
fmt
.
Println
(
"Cannot find go-bindata executable in path"
)
...
...
@@ -33,26 +51,43 @@ func main() {
fmt
.
Fprintln
(
os
.
Stderr
,
"Cannot write 'bindata_assetfs.go'"
,
err
)
return
}
debug
:=
isDebug
(
os
.
Args
[
1
:
])
r
:=
bufio
.
NewReader
(
in
)
done
:=
false
for
line
,
isPrefix
,
err
:=
r
.
ReadLine
();
err
==
nil
;
line
,
isPrefix
,
err
=
r
.
ReadLine
()
{
line
=
append
(
line
,
'\n'
)
if
!
isPrefix
{
line
=
append
(
line
,
'\n'
)
}
if
_
,
err
:=
out
.
Write
(
line
);
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
"Cannot write to 'bindata_assetfs.go'"
,
err
)
return
}
if
!
done
&&
!
isPrefix
&&
bytes
.
HasPrefix
(
line
,
[]
byte
(
"import ("
))
{
fmt
.
Fprintln
(
out
,
"
\t\"
github.com/elazarl/go-bindata-assetfs
\"
"
)
if
debug
{
fmt
.
Fprintln
(
out
,
"
\t\"
net/http
\"
"
)
}
else
{
fmt
.
Fprintln
(
out
,
"
\t\"
github.com/elazarl/go-bindata-assetfs
\"
"
)
}
done
=
true
}
}
fmt
.
Fprintln
(
out
,
`
if
debug
{
fmt
.
Fprintln
(
out
,
`
func assetFS() http.FileSystem {
for k := range _bintree.Children {
return http.Dir(k)
}
panic("unreachable")
}`
)
}
else
{
fmt
.
Fprintln
(
out
,
`
func assetFS() *assetfs.AssetFS {
for k := range _bintree.Children {
return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: k}
}
panic("unreachable")
}`
)
}
// Close files BEFORE remove calls (don't use defer).
in
.
Close
()
out
.
Close
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment