Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make staticcheck happy #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions appended.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func init() {
box = &appendedBox{
Name: boxName,
Files: make(map[string]*appendedFile),
Time: f.ModTime(),
Time: f.Modified,
}
appendedBoxes[boxName] = box
}
Expand All @@ -73,7 +73,7 @@ func init() {
af.dir = true
af.dirInfo = &appendedDirInfo{
name: filepath.Base(af.zipFile.Name),
time: af.zipFile.ModTime(),
time: af.zipFile.Modified,
}
} else {
// this is a file, we need it's contents so we can create a bytes.Reader when the file is opened
Expand Down
14 changes: 8 additions & 6 deletions box.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ func findBox(name string, order []LocateMethod) (*Box, error) {

case LocateFS:
// resolve absolute directory path
err := b.resolveAbsolutePathFromCaller()
err = b.resolveAbsolutePathFromCaller()
if err != nil {
continue
}
// check if absolutePath exists on filesystem
info, err := os.Stat(b.absolutePath)
if err != nil {
info, statErr := os.Stat(b.absolutePath)
if statErr != nil {
err = statErr
continue
}
// check if absolutePath is actually a directory
Expand All @@ -69,13 +70,14 @@ func findBox(name string, order []LocateMethod) (*Box, error) {
return b, nil
case LocateWorkingDirectory:
// resolve absolute directory path
err := b.resolveAbsolutePathFromWorkingDirectory()
err = b.resolveAbsolutePathFromWorkingDirectory()
if err != nil {
continue
}
// check if absolutePath exists on filesystem
info, err := os.Stat(b.absolutePath)
if err != nil {
info, statErr := os.Stat(b.absolutePath)
if statErr != nil {
err = statErr
continue
}
// check if absolutePath is actually a directory
Expand Down
6 changes: 3 additions & 3 deletions virtual.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ func (vf *virtualFile) seek(offset int64, whence int) (int64, error) {

//++ TODO: check if this is correct implementation for seek
switch whence {
case os.SEEK_SET:
case io.SeekStart:
//++ check if new offset isn't out of bounds, set e when it is, then break out of switch
vf.offset = offset
case os.SEEK_CUR:
case io.SeekCurrent:
//++ check if new offset isn't out of bounds, set e when it is, then break out of switch
vf.offset += offset
case os.SEEK_END:
case io.SeekEnd:
//++ check if new offset isn't out of bounds, set e when it is, then break out of switch
vf.offset = int64(len(vf.EmbeddedFile.Content)) - offset
}
Expand Down