Created
January 28, 2015 00:40
-
-
Save brian-brazil/0022440426ea12728651 to your computer and use it in GitHub Desktop.
https://github.com/prometheus/prometheus/issues/484 minimal test case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"os" | |
) | |
var path = flag.String("path", "./abc", "Path to create test file") | |
func main() { | |
flag.Parse() | |
f, err := os.Create(*path) | |
if err != nil { | |
panic(err) | |
} | |
f.Write([]byte("a\n")) | |
f.Close() | |
f, err = os.OpenFile(*path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0640) | |
if err != nil { | |
panic(err) | |
} | |
f.Write([]byte("bc\n")) | |
offset, err := f.Seek(0, os.SEEK_CUR) | |
if err != nil { | |
panic(err) | |
} | |
fmt.Printf("lseek returns: %d Expected: 5\n", offset) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment