We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
EDITed: fixed typo The following code demonstrates this behavior, it should print
OS=<datadata> FS=<datadata>
but the FS line reads FS=<testdatadata>
FS=<testdatadata>
package main import ( "os" "fmt" "io/ioutil" "github.com/spf13/afero" ) func main() { fileName := "./afero-demo2.txt" fh1, err := os.Create(fileName) if err != nil { panic("os.Create failed: "+err.Error()) } _, err = fh1.Write([]byte("test")) if err != nil { panic("fh.Write failed: "+err.Error()) } fh1.Seek(0, os.SEEK_SET) fh2, err := os.OpenFile(fileName, os.O_RDWR, 0777) if err != nil { panic("os.OpenFile failed: "+err.Error()) } fh2.Seek(0, os.SEEK_END) fh2.Write([]byte("data")) fh2.Close() fh1.Write([]byte("data")) fh1.Close() // the file now should contain "datadata" data, _ := ioutil.ReadFile(fileName) fmt.Printf("OS=<%s>\n", data) fs := &afero.MemMapFs{} afh1, err := fs.Create(fileName) if err != nil { panic("fs.Create failed: "+err.Error()) } _, err = afh1.Write([]byte("test")) if err != nil { panic("fh.Write failed: "+err.Error()) } afh1.Seek(0, os.SEEK_SET) afh2, err := fs.OpenFile(fileName, os.O_RDWR, 0777) if err != nil { panic("fs.OpenFile failed: "+err.Error()) } afh2.Seek(0, os.SEEK_END) afh2.Write([]byte("data")) afh2.Close() afh1.Write([]byte("data")) afh1.Close() // the file now should contain "datadata" data, _ = afero.ReadFile(fs, fileName) fmt.Printf("FS=<%s>\n", data) }
The text was updated successfully, but these errors were encountered:
mbertschler
No branches or pull requests
EDITed: fixed typo
The following code demonstrates this behavior, it should print
but the FS line reads
FS=<testdatadata>
The text was updated successfully, but these errors were encountered: