mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Adds the possiblility to append to files to obidistribute
This commit is contained in:
@ -55,7 +55,18 @@ func WriteSequencesToFile(iterator obiiter.IBioSequence,
|
||||
filename string,
|
||||
options ...WithOption) (obiiter.IBioSequence, error) {
|
||||
|
||||
file, err := os.Create(filename)
|
||||
var file *os.File
|
||||
var err error
|
||||
|
||||
opt := MakeOptions(options)
|
||||
|
||||
if opt.AppendFile() {
|
||||
log.Debug("Open files in appending mode")
|
||||
file, err = os.OpenFile(filename,
|
||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
} else {
|
||||
file, err = os.Create(filename)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("open file error: %v", err)
|
||||
|
Reference in New Issue
Block a user