Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Mihail Stoykov <[email protected]>
  • Loading branch information
oleiade and mstoykov authored Nov 8, 2023
1 parent fa8dfe1 commit b44a10f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/modules/k6/experimental/fs/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (fr *cache) open(filename string, fromFs fsext.Fs) (data []byte, err error)

// The underlying fsext.Fs.Open method will cache the file content during this
// operation. Which will lead to effectively holding the content of the file in memory twice.
// However, as per #1079, we plan to eventually reduce our dependency on fsext, and
// However, as per #1079, we plan to eventually reduce our dependency on afero, and
// expect this issue to be resolved at that point.
// TODO: re-evaluate opening from the FS this once #1079 is resolved.
f, err := fromFs.Open(filename)
Expand Down
2 changes: 1 addition & 1 deletion js/modules/k6/experimental/fs/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type file struct {
// Stat returns a FileInfo describing the named file.
func (f *file) stat() *FileInfo {
filename := filepath.Base(f.path)
return &FileInfo{Name: filename, Size: len(f.data)}
return &FileInfo{Name: filename, Size: f.size()}

Check failure on line 29 in js/modules/k6/experimental/fs/file.go

View workflow job for this annotation

GitHub Actions / test-prev (1.20.x, ubuntu-latest)

cannot use f.size() (value of type int64) as int value in struct literal

Check failure on line 29 in js/modules/k6/experimental/fs/file.go

View workflow job for this annotation

GitHub Actions / test-prev (1.20.x, windows-2019)

cannot use f.size() (value of type int64) as int value in struct literal

Check failure on line 29 in js/modules/k6/experimental/fs/file.go

View workflow job for this annotation

GitHub Actions / lint

cannot use f.size() (value of type int64) as int value in struct literal) (typecheck)

Check failure on line 29 in js/modules/k6/experimental/fs/file.go

View workflow job for this annotation

GitHub Actions / lint

cannot use f.size() (value of type int64) as int value in struct literal (typecheck)

Check failure on line 29 in js/modules/k6/experimental/fs/file.go

View workflow job for this annotation

GitHub Actions / test-tip (ubuntu-latest)

cannot use f.size() (value of type int64) as int value in struct literal

Check failure on line 29 in js/modules/k6/experimental/fs/file.go

View workflow job for this annotation

GitHub Actions / test-current-cov (1.21.x, ubuntu-latest)

cannot use f.size() (value of type int64) as int value in struct literal

Check failure on line 29 in js/modules/k6/experimental/fs/file.go

View workflow job for this annotation

GitHub Actions / test-current-cov (1.21.x, windows-2019)

cannot use f.size() (value of type int64) as int value in struct literal

Check failure on line 29 in js/modules/k6/experimental/fs/file.go

View workflow job for this annotation

GitHub Actions / test-tip (windows-2019)

cannot use f.size() (value of type int64) as int value in struct literal

Check failure on line 29 in js/modules/k6/experimental/fs/file.go

View workflow job for this annotation

GitHub Actions / build

cannot use f.size() (value of type int64) as int value in struct literal
}

// FileInfo holds information about a file.
Expand Down
2 changes: 1 addition & 1 deletion js/modules/k6/experimental/fs/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (mi *ModuleInstance) openImpl(path string) (*File, error) {

fs, ok := initEnv.FileSystems["file"]
if !ok {
common.Throw(mi.vu.Runtime(), errors.New("open() failed; reason: unable to access the file system"))
return nil, errors.New("open() failed; reason: unable to access the file system")
}

if exists, err := fsext.Exists(fs, path); err != nil {
Expand Down

0 comments on commit b44a10f

Please sign in to comment.