Skip to content

memory filesystem file.Seek should allow to seek to larger than size position. #268

@chutuananh2k

Description

@chutuananh2k

Describe the bug
in memory backend, if you call file.Seek to a possition that larger than current file size will return error Invalid offset. Common behaviour is to allow to seek beyond the current file size and update new file size to cover new possition.

        fs := _mem.NewFileSystem()
	_, err := file.WriteAt(0, []byte("hello world"))
	if err != nil {
		log.Fatal(err)
	}

	_, err = file.WriteAt(100, []byte("hello world 2"))
	if err != nil {
// -> invalid offset
		log.Fatal(err)
	}

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions