diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index c76762dc24..d63aa62615 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -4227,7 +4227,8 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Comment": "v0.2.0-14-g8e90cee79f8237", + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/cmd/openapi-gen", diff --git a/staging/src/k8s.io/api/Godeps/Godeps.json b/staging/src/k8s.io/api/Godeps/Godeps.json index 7371564eec..ad0e48fc1a 100644 --- a/staging/src/k8s.io/api/Godeps/Godeps.json +++ b/staging/src/k8s.io/api/Godeps/Godeps.json @@ -240,7 +240,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer", diff --git a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json index 3e8fdd9ebf..34f63722b7 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json @@ -2256,7 +2256,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/builder", diff --git a/staging/src/k8s.io/apimachinery/Godeps/Godeps.json b/staging/src/k8s.io/apimachinery/Godeps/Godeps.json index 5695993fce..9af33f57cc 100644 --- a/staging/src/k8s.io/apimachinery/Godeps/Godeps.json +++ b/staging/src/k8s.io/apimachinery/Godeps/Godeps.json @@ -172,7 +172,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", diff --git a/staging/src/k8s.io/apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiserver/Godeps/Godeps.json index 0ebf89c7ed..ff350cd56e 100644 --- a/staging/src/k8s.io/apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiserver/Godeps/Godeps.json @@ -1972,7 +1972,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/builder", diff --git a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json index 59b09ba887..1f39e9de6a 100644 --- a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json +++ b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json @@ -652,7 +652,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/common", diff --git a/staging/src/k8s.io/client-go/Godeps/Godeps.json b/staging/src/k8s.io/client-go/Godeps/Godeps.json index c82b71e658..9513e56891 100644 --- a/staging/src/k8s.io/client-go/Godeps/Godeps.json +++ b/staging/src/k8s.io/client-go/Godeps/Godeps.json @@ -616,7 +616,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", diff --git a/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json b/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json index 6eee62b2eb..45d6a8b5ad 100644 --- a/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json +++ b/staging/src/k8s.io/cloud-provider/Godeps/Godeps.json @@ -992,7 +992,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", diff --git a/staging/src/k8s.io/cluster-bootstrap/Godeps/Godeps.json b/staging/src/k8s.io/cluster-bootstrap/Godeps/Godeps.json index e63163ef2a..44126c3ef1 100644 --- a/staging/src/k8s.io/cluster-bootstrap/Godeps/Godeps.json +++ b/staging/src/k8s.io/cluster-bootstrap/Godeps/Godeps.json @@ -144,7 +144,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" } ] } diff --git a/staging/src/k8s.io/code-generator/Godeps/Godeps.json b/staging/src/k8s.io/code-generator/Godeps/Godeps.json index b1f61b7877..3eed183089 100644 --- a/staging/src/k8s.io/code-generator/Godeps/Godeps.json +++ b/staging/src/k8s.io/code-generator/Godeps/Godeps.json @@ -196,7 +196,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" } ] } diff --git a/staging/src/k8s.io/component-base/Godeps/Godeps.json b/staging/src/k8s.io/component-base/Godeps/Godeps.json index ffd7e6cf5e..7dedc450a8 100644 --- a/staging/src/k8s.io/component-base/Godeps/Godeps.json +++ b/staging/src/k8s.io/component-base/Godeps/Godeps.json @@ -148,7 +148,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/utils/pointer", diff --git a/staging/src/k8s.io/csi-api/Godeps/Godeps.json b/staging/src/k8s.io/csi-api/Godeps/Godeps.json index fdb23b7fc1..105e2acc3c 100644 --- a/staging/src/k8s.io/csi-api/Godeps/Godeps.json +++ b/staging/src/k8s.io/csi-api/Godeps/Godeps.json @@ -536,7 +536,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", diff --git a/staging/src/k8s.io/csi-translation-lib/Godeps/Godeps.json b/staging/src/k8s.io/csi-translation-lib/Godeps/Godeps.json index b638f2a18d..b6150b2ba8 100644 --- a/staging/src/k8s.io/csi-translation-lib/Godeps/Godeps.json +++ b/staging/src/k8s.io/csi-translation-lib/Godeps/Godeps.json @@ -148,7 +148,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" } ] } diff --git a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json index 1c0252238e..bd99e7c612 100644 --- a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json @@ -1812,7 +1812,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/aggregator", diff --git a/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json b/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json index aa5b57e5b2..8caa127eed 100644 --- a/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-controller-manager/Godeps/Godeps.json @@ -148,7 +148,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/utils/pointer", diff --git a/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json b/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json index 3304cbc9ac..3b99e80210 100644 --- a/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-proxy/Godeps/Godeps.json @@ -148,7 +148,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/utils/pointer", diff --git a/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json b/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json index 8eae6ee2a7..812774fcff 100644 --- a/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-scheduler/Godeps/Godeps.json @@ -148,7 +148,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/utils/pointer", diff --git a/staging/src/k8s.io/kubelet/Godeps/Godeps.json b/staging/src/k8s.io/kubelet/Godeps/Godeps.json index 72fad3e015..e37b2b8d5c 100644 --- a/staging/src/k8s.io/kubelet/Godeps/Godeps.json +++ b/staging/src/k8s.io/kubelet/Godeps/Godeps.json @@ -144,7 +144,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" } ] } diff --git a/staging/src/k8s.io/metrics/Godeps/Godeps.json b/staging/src/k8s.io/metrics/Godeps/Godeps.json index a2826625dc..68ffea7ca2 100644 --- a/staging/src/k8s.io/metrics/Godeps/Godeps.json +++ b/staging/src/k8s.io/metrics/Godeps/Godeps.json @@ -512,7 +512,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", diff --git a/staging/src/k8s.io/node-api/Godeps/Godeps.json b/staging/src/k8s.io/node-api/Godeps/Godeps.json index db6cb73bd6..8efae005d1 100644 --- a/staging/src/k8s.io/node-api/Godeps/Godeps.json +++ b/staging/src/k8s.io/node-api/Godeps/Godeps.json @@ -536,7 +536,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", diff --git a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json index 6a7a3e5dae..9a1f9b95e4 100644 --- a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json @@ -1768,7 +1768,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/builder", diff --git a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json index d01f443f67..050aef8e6f 100644 --- a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json @@ -724,7 +724,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/common", diff --git a/staging/src/k8s.io/sample-controller/Godeps/Godeps.json b/staging/src/k8s.io/sample-controller/Godeps/Godeps.json index 515e5b49c6..d4347c4be5 100644 --- a/staging/src/k8s.io/sample-controller/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-controller/Godeps/Godeps.json @@ -1176,7 +1176,7 @@ }, { "ImportPath": "k8s.io/klog", - "Rev": "8139d8cb77af419532b33dfa7dd09fbc5f1d344f" + "Rev": "8e90cee79f823779174776412c13478955131846" }, { "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", diff --git a/vendor/k8s.io/klog/.travis.yml b/vendor/k8s.io/klog/.travis.yml index fc0d2caf33..0f508dae66 100644 --- a/vendor/k8s.io/klog/.travis.yml +++ b/vendor/k8s.io/klog/.travis.yml @@ -1,4 +1,5 @@ language: go +go_import_path: k8s.io/klog dist: xenial go: - 1.9.x diff --git a/vendor/k8s.io/klog/CONTRIBUTING.md b/vendor/k8s.io/klog/CONTRIBUTING.md index de47115137..574a56abbb 100644 --- a/vendor/k8s.io/klog/CONTRIBUTING.md +++ b/vendor/k8s.io/klog/CONTRIBUTING.md @@ -8,10 +8,6 @@ _As contributors and maintainers of this project, and in the interest of fosteri We have full documentation on how to get started contributing here: - - - [Contributor License Agreement](https://git.k8s.io/community/CLA.md) Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests - [Kubernetes Contributor Guide](http://git.k8s.io/community/contributors/guide) - Main contributor documentation, or you can just jump directly to the [contributing section](http://git.k8s.io/community/contributors/guide#contributing) - [Contributor Cheat Sheet](https://git.k8s.io/community/contributors/guide/contributor-cheatsheet.md) - Common resources for existing developers @@ -20,12 +16,7 @@ If your repo has certain guidelines for contribution, put them here ahead of the - [Mentoring Initiatives](https://git.k8s.io/community/mentoring) - We have a diverse set of mentorship programs available that are always looking for volunteers! - +- [Slack](https://kubernetes.slack.com/messages/sig-architecture) +- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-architecture) diff --git a/vendor/k8s.io/klog/OWNERS b/vendor/k8s.io/klog/OWNERS index 56b0eb044f..380e514f28 100644 --- a/vendor/k8s.io/klog/OWNERS +++ b/vendor/k8s.io/klog/OWNERS @@ -1,5 +1,13 @@ -# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md - +# See the OWNERS docs at https://go.k8s.io/owners +reviewers: + - jayunit100 + - hoegaarden + - andyxning + - neolit123 + - pohly + - yagonobre + - vincepri + - detiber approvers: - dims - thockin diff --git a/vendor/k8s.io/klog/README.md b/vendor/k8s.io/klog/README.md index a747f538a8..6cb6d16837 100644 --- a/vendor/k8s.io/klog/README.md +++ b/vendor/k8s.io/klog/README.md @@ -5,6 +5,32 @@ klog is a permanant fork of https://github.com/golang/glog. original README from ---- +How to use klog +=============== +- Replace imports for `github.com/golang/glog` with `k8s.io/klog` +- Use `klog.InitFlags(nil)` explicitly for initializing global flags as we no longer use `init()` method to register the flags +- You can now use `log-file` instead of `log-dir` for logging to a single file (See `examples/log_file/usage_log_file.go`) +- If you want to redirect everything logged using klog somewhere else (say syslog!), you can use `klog.SetOutput()` method and supply a `io.Writer`. (See `examples/set_output/usage_set_output.go`) +- For more logging conventions (See [Logging Conventions](https://github.com/kubernetes/community/blob/master/contributors/devel/logging.md)) + +### Coexisting with glog +This package can be used side by side with glog. [This example](examples/coexist_glog/coexist_glog.go) shows how to initialize and syncronize flags from the global `flag.CommandLine` FlagSet. In addition, the example makes use of stderr as combined output by setting `alsologtostderr` (or `logtostderr`) to `true`. + +## Community, discussion, contribution, and support + +Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/). + +You can reach the maintainers of this project at: + +- [Slack](https://kubernetes.slack.com/messages/sig-architecture) +- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-architecture) + +### Code of conduct + +Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md). + +---- + glog ==== @@ -26,20 +52,20 @@ The comment from glog.go introduces the ideas: Error, Fatal, plus formatting variants such as Infof. It also provides V-style logging controlled by the -v and -vmodule=file=2 flags. - + Basic examples: - + glog.Info("Prepare to repel boarders") - + glog.Fatalf("Initialization failed: %s", err) - + See the documentation for the V function for an explanation of these examples: - + if glog.V(2) { glog.Info("Starting transaction...") } - + glog.V(2).Infoln("Processed", nItems, "elements") diff --git a/vendor/k8s.io/klog/code-of-conduct.md b/vendor/k8s.io/klog/code-of-conduct.md new file mode 100644 index 0000000000..0d15c00cf3 --- /dev/null +++ b/vendor/k8s.io/klog/code-of-conduct.md @@ -0,0 +1,3 @@ +# Kubernetes Community Code of Conduct + +Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md) diff --git a/vendor/k8s.io/klog/klog.go b/vendor/k8s.io/klog/klog.go index 13bcc81a75..398cd1c5db 100644 --- a/vendor/k8s.io/klog/klog.go +++ b/vendor/k8s.io/klog/klog.go @@ -410,9 +410,9 @@ func InitFlags(flagset *flag.FlagSet) { } flagset.StringVar(&logging.logDir, "log_dir", "", "If non-empty, write log files in this directory") flagset.StringVar(&logging.logFile, "log_file", "", "If non-empty, use this log file") - flagset.BoolVar(&logging.toStderr, "logtostderr", false, "log to standard error instead of files") + flagset.BoolVar(&logging.toStderr, "logtostderr", true, "log to standard error instead of files") flagset.BoolVar(&logging.alsoToStderr, "alsologtostderr", false, "log to standard error as well as files") - flagset.Var(&logging.verbosity, "v", "log level for V logs") + flagset.Var(&logging.verbosity, "v", "number for the log level verbosity") flagset.BoolVar(&logging.skipHeaders, "skip_headers", false, "If true, avoid header prefixes in the log messages") flagset.Var(&logging.stderrThreshold, "stderrthreshold", "logs at or above this threshold go to stderr") flagset.Var(&logging.vmodule, "vmodule", "comma-separated list of pattern=N settings for file-filtered logging") @@ -872,7 +872,7 @@ func (sb *syncBuffer) Sync() error { func (sb *syncBuffer) Write(p []byte) (n int, err error) { if sb.nbytes+uint64(len(p)) >= MaxSize { - if err := sb.rotateFile(time.Now()); err != nil { + if err := sb.rotateFile(time.Now(), false); err != nil { sb.logger.exit(err) } } @@ -885,13 +885,15 @@ func (sb *syncBuffer) Write(p []byte) (n int, err error) { } // rotateFile closes the syncBuffer's file and starts a new one. -func (sb *syncBuffer) rotateFile(now time.Time) error { +// The startup argument indicates whether this is the initial startup of klog. +// If startup is true, existing files are opened for apending instead of truncated. +func (sb *syncBuffer) rotateFile(now time.Time, startup bool) error { if sb.file != nil { sb.Flush() sb.file.Close() } var err error - sb.file, _, err = create(severityName[sb.sev], now) + sb.file, _, err = create(severityName[sb.sev], now, startup) sb.nbytes = 0 if err != nil { return err @@ -926,7 +928,7 @@ func (l *loggingT) createFiles(sev severity) error { logger: l, sev: s, } - if err := sb.rotateFile(now); err != nil { + if err := sb.rotateFile(now, true); err != nil { return err } l.file[s] = sb @@ -934,7 +936,7 @@ func (l *loggingT) createFiles(sev severity) error { return nil } -const flushInterval = 30 * time.Second +const flushInterval = 5 * time.Second // flushDaemon periodically flushes the log file buffers. func (l *loggingT) flushDaemon() { diff --git a/vendor/k8s.io/klog/klog_file.go b/vendor/k8s.io/klog/klog_file.go index b76a4e10be..1c4897f4fd 100644 --- a/vendor/k8s.io/klog/klog_file.go +++ b/vendor/k8s.io/klog/klog_file.go @@ -97,9 +97,11 @@ var onceLogDirs sync.Once // contains tag ("INFO", "FATAL", etc.) and t. If the file is created // successfully, create also attempts to update the symlink for that tag, ignoring // errors. -func create(tag string, t time.Time) (f *os.File, filename string, err error) { +// The startup argument indicates whether this is the initial startup of klog. +// If startup is true, existing files are opened for apending instead of truncated. +func create(tag string, t time.Time, startup bool) (f *os.File, filename string, err error) { if logging.logFile != "" { - f, err := os.Create(logging.logFile) + f, err := openOrCreate(logging.logFile, startup) if err == nil { return f, logging.logFile, nil } @@ -113,7 +115,7 @@ func create(tag string, t time.Time) (f *os.File, filename string, err error) { var lastErr error for _, dir := range logDirs { fname := filepath.Join(dir, name) - f, err := os.Create(fname) + f, err := openOrCreate(fname, startup) if err == nil { symlink := filepath.Join(dir, link) os.Remove(symlink) // ignore err @@ -124,3 +126,14 @@ func create(tag string, t time.Time) (f *os.File, filename string, err error) { } return nil, "", fmt.Errorf("log: cannot create log: %v", lastErr) } + +// The startup argument indicates whether this is the initial startup of klog. +// If startup is true, existing files are opened for appending instead of truncated. +func openOrCreate(name string, startup bool) (*os.File, error) { + if startup { + f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) + return f, err + } + f, err := os.Create(name) + return f, err +}