all: Revert the underscore sillyness

This commit is contained in:
Jakob Borg
2019-02-02 12:16:27 +01:00
parent 9fd270d78e
commit c2ddc83509
70 changed files with 252 additions and 252 deletions

View File

@@ -44,7 +44,7 @@ func (s *auditService) Serve() {
for {
select {
case ev := <-sub.C():
_ = enc.Encode(ev)
enc.Encode(ev)
case <-s.stop:
return
}

View File

@@ -13,6 +13,6 @@ import "time"
func cpuUsage() time.Duration {
var rusage syscall.Rusage
_ = syscall.Getrusage(syscall.RUSAGE_SELF, &rusage)
syscall.Getrusage(syscall.RUSAGE_SELF, &rusage)
return time.Duration(rusage.Utime.Nano() + rusage.Stime.Nano())
}

View File

@@ -965,7 +965,7 @@ func (s *apiService) postSystemShutdown(w http.ResponseWriter, r *http.Request)
}
func (s *apiService) flushResponse(resp string, w http.ResponseWriter) {
_, _ = w.Write([]byte(resp + "\n"))
w.Write([]byte(resp + "\n"))
f := w.(http.Flusher)
f.Flush()
}
@@ -1152,7 +1152,7 @@ func (s *apiService) getSupportBundle(w http.ResponseWriter, r *http.Request) {
// Serve the buffer zip to client for download
w.Header().Set("Content-Type", "application/zip")
w.Header().Set("Content-Disposition", "attachment; filename="+zipFileName)
_, _ = io.Copy(w, &zipFilesBuffer)
io.Copy(w, &zipFilesBuffer)
}
func (s *apiService) getSystemHTTPMetrics(w http.ResponseWriter, r *http.Request) {
@@ -1172,7 +1172,7 @@ func (s *apiService) getSystemHTTPMetrics(w http.ResponseWriter, r *http.Request
}
})
bs, _ := json.MarshalIndent(stats, "", " ")
_, _ = w.Write(bs)
w.Write(bs)
}
func (s *apiService) getSystemDiscovery(w http.ResponseWriter, r *http.Request) {
@@ -1464,7 +1464,7 @@ func (s *apiService) getQR(w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Content-Type", "image/png")
_, _ = w.Write(code.PNG())
w.Write(code.PNG())
}
func (s *apiService) getPeerCompletion(w http.ResponseWriter, r *http.Request) {
@@ -1562,7 +1562,7 @@ func (s *apiService) getSystemBrowse(w http.ResponseWriter, r *http.Request) {
// Default value or in case of error unmarshalling ends up being basic fs.
var fsType fs.FilesystemType
_ = fsType.UnmarshalText([]byte(qs.Get("filesystem")))
fsType.UnmarshalText([]byte(qs.Get("filesystem")))
sendJSON(w, browseFiles(current, fsType))
}
@@ -1659,7 +1659,7 @@ func (s *apiService) getHeapProf(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Disposition", "attachment; filename="+filename)
runtime.GC()
_ = pprof.WriteHeapProfile(w)
pprof.WriteHeapProfile(w)
}
func toJsonFileInfoSlice(fs []db.FileInfoTruncated) []jsonDBFileInfo {

View File

@@ -160,7 +160,7 @@ func (s *staticsServer) serveAsset(w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Content-Length", fmt.Sprintf("%d", len(bs)))
_, _ = w.Write(bs)
w.Write(bs)
}
func (s *staticsServer) serveThemes(w http.ResponseWriter, r *http.Request) {

View File

@@ -114,13 +114,13 @@ func TestAssetsDir(t *testing.T) {
// The asset map contains compressed assets, so create a couple of gzip compressed assets here.
buf := new(bytes.Buffer)
gw := gzip.NewWriter(buf)
_, _ = gw.Write([]byte("default"))
gw.Write([]byte("default"))
gw.Close()
def := buf.Bytes()
buf = new(bytes.Buffer)
gw = gzip.NewWriter(buf)
_, _ = gw.Write([]byte("foo"))
gw.Write([]byte("foo"))
gw.Close()
foo := buf.Bytes()

View File

@@ -49,7 +49,7 @@ func saveHeapProfiles(rate int) {
panic(err)
}
_ = os.Remove(name) // Error deliberately ignored
os.Remove(name) // Error deliberately ignored
err = os.Rename(name+".tmp", name)
if err != nil {
panic(err)

View File

@@ -634,7 +634,7 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
// Attempt to increase the limit on number of open files to the maximum
// allowed, in case we have many peers. We don't really care enough to
// report the error if there is one.
_, _ = osutil.MaximizeOpenFileLimit()
osutil.MaximizeOpenFileLimit()
// Ensure that we have a certificate and key.
cert, err := tls.LoadX509KeyPair(locations[locCertFile], locations[locKeyFile])
@@ -757,7 +757,7 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
// Add and start folders
for _, folderCfg := range cfg.Folders() {
if folderCfg.Paused {
_ = folderCfg.CreateRoot()
folderCfg.CreateRoot()
continue
}
m.AddFolder(folderCfg)
@@ -847,8 +847,8 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
l.Infoln("Anonymous usage reporting is always enabled for candidate releases.")
if opts.URAccepted != usageReportVersion {
opts.URAccepted = usageReportVersion
_, _ = cfg.SetOptions(opts)
_ = cfg.Save()
cfg.SetOptions(opts)
cfg.Save()
// Unique ID will be set and config saved below if necessary.
}
}
@@ -856,8 +856,8 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
// If we are going to do usage reporting, ensure we have a valid unique ID.
if opts := cfg.Options(); opts.URAccepted > 0 && opts.URUniqueID == "" {
opts.URUniqueID = rand.String(8)
_, _ = cfg.SetOptions(opts)
_ = cfg.Save()
cfg.SetOptions(opts)
cfg.Save()
}
usageReportingSvc := newUsageReportingService(cfg, m, connectionsService)
@@ -877,8 +877,8 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
opts.AutoUpgradeIntervalH = 12
// Set the option into the config as well, as the auto upgrade
// loop expects to read a valid interval from there.
_, _ = cfg.SetOptions(opts)
_ = cfg.Save()
cfg.SetOptions(opts)
cfg.Save()
}
// We don't tweak the user's choice of upgrading to pre-releases or
// not, as otherwise they cannot step off the candidate channel.
@@ -959,7 +959,7 @@ func loadConfigAtStartup() *config.Wrapper {
cfg, err := config.Load(cfgFile, myID)
if os.IsNotExist(err) {
cfg = defaultConfig(cfgFile)
_ = cfg.Save()
cfg.Save()
l.Infof("Default config saved. Edit %s to taste or use the GUI\n", cfg.ConfigPath())
} else if err == io.EOF {
l.Fatalln("Failed to load config: unexpected end of file. Truncated or empty configuration?")

View File

@@ -30,7 +30,7 @@ func (c *mockedConfig) LDAP() config.LDAPConfiguration {
func (c *mockedConfig) RawCopy() config.Configuration {
cfg := config.Configuration{}
_ = util.SetDefaults(&cfg.Options)
util.SetDefaults(&cfg.Options)
return cfg
}

View File

@@ -127,13 +127,13 @@ func monitorMain(runtimeOptions RuntimeOptions) {
select {
case s := <-stopSign:
l.Infof("Signal %d received; exiting", s)
_ = cmd.Process.Signal(sigTerm)
cmd.Process.Signal(sigTerm)
<-exit
return
case s := <-restartSign:
l.Infof("Signal %d received; restarting", s)
_ = cmd.Process.Signal(sigHup)
cmd.Process.Signal(sigHup)
err = <-exit
case err = <-exit:
@@ -179,7 +179,7 @@ func copyStderr(stderr io.Reader, dst io.Writer) {
}
if panicFd == nil {
_, _ = dst.Write([]byte(line))
dst.Write([]byte(line))
if strings.Contains(line, "SIGILL") {
l.Warnln(`
@@ -226,20 +226,20 @@ func copyStderr(stderr io.Reader, dst io.Writer) {
stdoutMut.Lock()
for _, line := range stdoutFirstLines {
_, _ = panicFd.WriteString(line)
panicFd.WriteString(line)
}
_, _ = panicFd.WriteString("...\n")
panicFd.WriteString("...\n")
for _, line := range stdoutLastLines {
_, _ = panicFd.WriteString(line)
panicFd.WriteString(line)
}
stdoutMut.Unlock()
}
_, _ = panicFd.WriteString("Panic at " + time.Now().Format(time.RFC3339) + "\n")
panicFd.WriteString("Panic at " + time.Now().Format(time.RFC3339) + "\n")
}
if panicFd != nil {
_, _ = panicFd.WriteString(line)
panicFd.WriteString(line)
}
}
}
@@ -263,7 +263,7 @@ func copyStdout(stdout io.Reader, dst io.Writer) {
}
stdoutMut.Unlock()
_, _ = dst.Write([]byte(line))
dst.Write([]byte(line))
}
}

View File

@@ -17,7 +17,7 @@ import (
func TestAutoClosedFile(t *testing.T) {
os.RemoveAll("_autoclose")
defer os.RemoveAll("_autoclose")
_ = os.Mkdir("_autoclose", 0755)
os.Mkdir("_autoclose", 0755)
file := filepath.FromSlash("_autoclose/tmp")
data := []byte("hello, world\n")

View File

@@ -19,11 +19,11 @@ func optionTable(w io.Writer, rows [][]string) {
for _, row := range rows {
for i, cell := range row {
if i > 0 {
_, _ = tw.Write([]byte("\t"))
tw.Write([]byte("\t"))
}
_, _ = tw.Write([]byte(cell))
tw.Write([]byte(cell))
}
_, _ = tw.Write([]byte("\n"))
tw.Write([]byte("\n"))
}
tw.Flush()
}

View File

@@ -427,7 +427,7 @@ func (*usageReportingService) String() string {
func cpuBench(iterations int, duration time.Duration, useWeakHash bool) float64 {
dataSize := 16 * protocol.MinBlockSize
bs := make([]byte, dataSize)
_, _ = rand.Reader.Read(bs)
rand.Reader.Read(bs)
var perf float64
for i := 0; i < iterations; i++ {