Skip to content

Commit

Permalink
Revert "Run gofmt and remove old deprecated build directives"
Browse files Browse the repository at this point in the history
This reverts commit 1ee15af.
  • Loading branch information
wcmjunior committed Sep 10, 2024
1 parent 139c063 commit fd25413
Show file tree
Hide file tree
Showing 27 changed files with 47 additions and 38 deletions.
3 changes: 2 additions & 1 deletion assets_dev.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//go:build !release
// +build !release

package main

import (
"net/http"
)

// HTTP auto generated
//HTTP auto generated
var HTTP http.FileSystem = http.Dir("./webgui")
1 change: 1 addition & 0 deletions assets_release.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//go:build release
// +build release

package main

Expand Down
9 changes: 4 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func (c *Config) createEntry(name string, configDir string) *Entry {
return entry
}

//
// Load the configuration and return loaded programs
func (c *Config) Load() ([]string, error) {
myini := ini.NewIni()
Expand Down Expand Up @@ -404,8 +405,7 @@ func parseEnvFiles(s string) *map[string]string {
}

// GetEnv returns slice of strings with keys separated from values by single "=". An environment string example:
//
// environment = A="env 1",B="this is a test"
// environment = A="env 1",B="this is a test"
func (c *Entry) GetEnv(key string) []string {
value, ok := c.keyValues[key]
result := make([]string, 0)
Expand All @@ -426,9 +426,7 @@ func (c *Entry) GetEnv(key string) []string {
}

// GetEnvFromFiles returns slice of strings with keys separated from values by single "=". An envFile example:
//
// envFiles = global.env,prod.env
//
// envFiles = global.env,prod.env
// cat global.env
// varA=valueA
func (c *Entry) GetEnvFromFiles(key string) []string {
Expand Down Expand Up @@ -514,6 +512,7 @@ func (c *Entry) GetStringArray(key string, sep string) []string {
// logSize=1GB
// logSize=1KB
// logSize=1024
//
func (c *Entry) GetBytes(key string, defValue int) int {
v, ok := c.keyValues[key]

Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package config

import (
"fmt"
"supervisord/util"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"supervisord/util"
"testing"
)

Expand Down
2 changes: 2 additions & 0 deletions config/process_sort_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"testing"
)

//
// check if program1 is before the program2 in the Entry
//
func isProgramBefore(entries []*Entry, program1 string, program2 string) bool {
order := 0
program1Order := -1
Expand Down
1 change: 1 addition & 0 deletions daemonize.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//go:build !windows
// +build !windows

package main

Expand Down
2 changes: 1 addition & 1 deletion daemonize_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build windows
// +build windows

package main

Expand Down
2 changes: 1 addition & 1 deletion events/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func TestProcessStartingEvent(t *testing.T) {
if event.GetType() != "PROCESS_STATE_STARTING" {
t.Error("Fail to creating the process starting event")
}
fmt.Printf("%s\n", event.GetBody())
fmt.Printf( "%s\n", event.GetBody() )
if event.GetBody() != "processname:proc-1 groupname:group-1 from_state:STOPPED tries:0" {
t.Error("Fail to encode the process starting event")
}
Expand Down
3 changes: 2 additions & 1 deletion logger/log_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows && !nacl && !plan9
// +build !windows,!nacl,!plan9

package logger

Expand Down Expand Up @@ -165,6 +165,7 @@ func (bs *BackendSysLogWriter) Close() error {
//
// - protocol, could be tcp or udp, assuming udp as default
// - port, if missing, by default for tcp is 6514 and for udp - 514
//
func parseSysLogConfig(config string) (protocol string, host string, port int, err error) {
fields := strings.Split(config, ":")
host = ""
Expand Down
1 change: 1 addition & 0 deletions logger/log_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//go:build windows || plan9 || nacl
// +build windows plan9 nacl

package logger

Expand Down
2 changes: 1 addition & 1 deletion pidproxy/signal.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows
// +build !windows

package main

Expand Down
1 change: 1 addition & 0 deletions pidproxy/signal_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//go:build windows
// +build windows

package main

Expand Down
1 change: 1 addition & 0 deletions process/command_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func parseCommand(command string) ([]string, error) {
}

// create command from string or []string
//
func createCommand(command interface{}) (*exec.Cmd, error) {
args := make([]string, 0)
var err error = nil
Expand Down
2 changes: 1 addition & 1 deletion process/pdeathsig_linux.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux
// +build linux

package process

Expand Down
3 changes: 2 additions & 1 deletion process/pdeathsig_other.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//go:build !linux && !windows
// +build !linux
// +build !windows

package process

Expand Down
2 changes: 1 addition & 1 deletion process/pdeathsig_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build windows
// +build windows

package process

Expand Down
4 changes: 2 additions & 2 deletions process/set_user_id.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//go:build !windows
// +build !windows

package process

import (
log "github.com/sirupsen/logrus"
"os/user"
"strconv"
"syscall"

log "github.com/sirupsen/logrus"
)

func setUserID(procAttr *syscall.SysProcAttr, uid uint32, gid uint32) {
Expand Down
2 changes: 1 addition & 1 deletion process/set_user_id_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build windows
// +build windows

package process

Expand Down
2 changes: 1 addition & 1 deletion rlimit.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows && !freebsd
// +build !windows,!freebsd

package main

Expand Down
2 changes: 1 addition & 1 deletion rlimit_freebsd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build freebsd
// +build freebsd

package main

Expand Down
2 changes: 1 addition & 1 deletion rlimit_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build windows
// +build windows

package main

Expand Down
8 changes: 4 additions & 4 deletions signals/signal.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows && !darwin
// +build !windows,!darwin

package signals

Expand Down Expand Up @@ -59,10 +59,10 @@ func ToSignal(signalName string) (os.Signal, error) {
// Kill sends signal to the process
//
// Args:
// process - the process which the signal should be sent to
// sig - the signal will be sent
// sigChildren - true if the signal needs to be sent to the children also
//
// process - the process which the signal should be sent to
// sig - the signal will be sent
// sigChildren - true if the signal needs to be sent to the children also
func Kill(process *os.Process, sig os.Signal, sigChildren bool) error {
localSig := sig.(syscall.Signal)
pid := process.Pid
Expand Down
8 changes: 4 additions & 4 deletions signals/signal_darwin.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build darwin
// +build darwin

package signals

Expand Down Expand Up @@ -57,10 +57,10 @@ func ToSignal(signalName string) (os.Signal, error) {
// Kill send signal to the process
//
// Args:
// process - the process which the signal should be sent to
// sig - the signal will be sent
// sigChildren - true if the signal needs to be sent to the children also
//
// process - the process which the signal should be sent to
// sig - the signal will be sent
// sigChildren - true if the signal needs to be sent to the children also
func Kill(process *os.Process, sig os.Signal, sigChildren bool) error {
localSig := sig.(syscall.Signal)
pid := process.Pid
Expand Down
14 changes: 7 additions & 7 deletions signals/signal_windows.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
//go:build windows
// +build windows

package signals

import (
"errors"
"fmt"
log "github.com/sirupsen/logrus"
"os"
"os/exec"
"syscall"

log "github.com/sirupsen/logrus"
)

// convert a signal name to signal
//convert a signal name to signal
func ToSignal(signalName string) (os.Signal, error) {
if signalName == "HUP" {
return syscall.SIGHUP, nil
Expand All @@ -35,11 +34,12 @@ func ToSignal(signalName string) (os.Signal, error) {

}

//
// Args:
// process - the process
// sig - the signal
// sigChildren - ignore in windows system
//
// process - the process
// sig - the signal
// sigChildren - ignore in windows system
func Kill(process *os.Process, sig os.Signal, sigChilren bool) error {
//Signal command can't kill children processes, call taskkill command to kill them
cmd := exec.Command("taskkill", "/F", "/T", "/PID", fmt.Sprintf("%d", process.Pid))
Expand Down
2 changes: 1 addition & 1 deletion types/process-name-sorter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (pns *ProcessNameSorter) Less(i, j int) bool {
// Swap i-th program and j-th program
func (pns *ProcessNameSorter) Swap(i, j int) {
swapF := reflect.Swapper(pns.processes)
swapF(i, j)
swapF(i,j)
}

// SortProcessInfos sorts the process information by program name
Expand Down
2 changes: 1 addition & 1 deletion zombie_reaper.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !windows
// +build !windows

package main

Expand Down
2 changes: 1 addition & 1 deletion zombie_reaper_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build windows
// +build windows

package main

Expand Down

0 comments on commit fd25413

Please sign in to comment.