From 29ccf10d0b8b2b4ef90e912f5affbdb6696a6f10 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 10 Oct 2016 17:16:18 +0200 Subject: [PATCH] cmd/syncthing: Only SetTraceback on Go 1.7+ (fixes #3664) --- cmd/syncthing/main.go | 4 ---- cmd/syncthing/traceback.go | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 cmd/syncthing/traceback.go diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index fb0774a3b..e0d9d5531 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -23,7 +23,6 @@ import ( "path/filepath" "regexp" "runtime" - "runtime/debug" "runtime/pprof" "sort" "strconv" @@ -281,9 +280,6 @@ func parseCommandLineOptions() RuntimeOptions { } func main() { - // We want all (our) goroutines in panic traces. - debug.SetTraceback("all") - options := parseCommandLineOptions() l.SetFlags(options.logFlags) diff --git a/cmd/syncthing/traceback.go b/cmd/syncthing/traceback.go new file mode 100644 index 000000000..c61b29a5c --- /dev/null +++ b/cmd/syncthing/traceback.go @@ -0,0 +1,17 @@ +// Copyright (C) 2016 The Syncthing Authors. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at http://mozilla.org/MPL/2.0/. + +//+build go1.7 + +package main + +import "runtime/debug" + +func init() { + // We want all (our) goroutines in panic traces. + debug.SetTraceback("all") +} +