mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-25 12:01:36 +01:00
a948fd7e10
use fmt instead of log log.Fatal -> return err set non-zero exit code on error print to default err log cleanup fix vet Co-authored-by: Norwin Roosen <git@nroo.de> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/308 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: 6543 <6543@obermui.de> Co-Authored-By: Norwin <noerw@noreply.gitea.io> Co-Committed-By: Norwin <noerw@noreply.gitea.io>
29 lines
562 B
Go
29 lines
562 B
Go
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package task
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"code.gitea.io/sdk/gitea"
|
|
)
|
|
|
|
// LabelsExport save list of labels to disc
|
|
func LabelsExport(labels []*gitea.Label, path string) error {
|
|
f, err := os.Create(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer f.Close()
|
|
|
|
for _, label := range labels {
|
|
if _, err := fmt.Fprintf(f, "#%s %s\n", label.Color, label.Name); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|