mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-08 16:50:27 +00:00
Adds the possiblility to append to files to obidistribute
This commit is contained in:
@@ -157,7 +157,19 @@ func WriteFastaToFile(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