Re-run gofmt -s after modifications

This commit is contained in:
Edznux 2018-10-23 06:35:22 +02:00
commit d80fef3ef9
11 changed files with 30 additions and 30 deletions

View file

@ -2,11 +2,11 @@ package core
import ( import (
"bytes" "bytes"
"github.com/evilsocket/islazy/fs"
"github.com/evilsocket/islazy/str"
"io" "io"
"os" "os"
"testing" "testing"
"github.com/evilsocket/islazy/str"
"github.com/evilsocket/islazy/fs"
) )
func hasInt(a []int, v int) bool { func hasInt(a []int, v int) bool {

View file

@ -273,7 +273,7 @@ func (s *SSLStripper) isMaxRedirs(hostname string) bool {
delete(s.redirs, hostname) delete(s.redirs, hostname)
return true return true
} }
// increment // increment
s.redirs[hostname]++ s.redirs[hostname]++
} else { } else {
// start tracking redirections // start tracking redirections

View file

@ -122,11 +122,11 @@ func (d *Discovery) Show(by string, expr string) (err error) {
} }
switch by { switch by {
case "seen" : case "seen":
sort.Sort(BySeenSorter(targets)) sort.Sort(BySeenSorter(targets))
case "sent" : case "sent":
sort.Sort(BySentSorter(targets)) sort.Sort(BySentSorter(targets))
case "rcvd" : case "rcvd":
sort.Sort(ByRcvdSorter(targets)) sort.Sort(ByRcvdSorter(targets))
default: default:
sort.Sort(ByAddressSorter(targets)) sort.Sort(ByAddressSorter(targets))

View file

@ -162,10 +162,10 @@ func (t *Endpoint) OnMeta(meta map[string]string) {
for k, v := range meta { for k, v := range meta {
// simple heuristics to get the longest candidate name // simple heuristics to get the longest candidate name
if len(v) > len(host) { if len(v) > len(host) {
if strings.HasSuffix(k, ":hostname"){ if strings.HasSuffix(k, ":hostname") {
host = v host = v
} }
if k == "mdns:md"{ if k == "mdns:md" {
host = v host = v
} }
} }

View file

@ -22,7 +22,7 @@ func setup(t testing.TB, envFile bool, envFileData bool) {
teardown(t) teardown(t)
if envFile { if envFile {
fp, err := os.OpenFile(testEnvFile, os.O_RDONLY|os.O_CREATE, 0666); fp, err := os.OpenFile(testEnvFile, os.O_RDONLY|os.O_CREATE, 0666)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -34,7 +34,7 @@ func setup(t testing.TB, envFile bool, envFileData bool) {
if err != nil { if err != nil {
panic(err) panic(err)
} }
err = ioutil.WriteFile(testEnvFile, raw, 0755); err = ioutil.WriteFile(testEnvFile, raw, 0755)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -276,7 +276,7 @@ func TestSessionEnvironmentGetInt(t *testing.T) {
} }
env.Data["num"] = "1234" env.Data["num"] = "1234"
err, i := env.GetInt("num"); err, i := env.GetInt("num")
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }

View file

@ -61,7 +61,7 @@ func (m *SessionModule) Param(name string) *ModuleParam {
func (m SessionModule) ListParam(name string) (err error, values []string) { func (m SessionModule) ListParam(name string) (err error, values []string) {
values = make([]string, 0) values = make([]string, 0)
err, list := m.StringParam(name); err, list := m.StringParam(name)
if err != nil { if err != nil {
return return
} }
@ -77,9 +77,9 @@ func (m SessionModule) ListParam(name string) (err error, values []string) {
} }
func (m SessionModule) StringParam(name string) (error, string) { func (m SessionModule) StringParam(name string) (error, string) {
p, found := m.params[name]; p, found := m.params[name]
if found { if found {
err, v := p.Get(m.Session); err, v := p.Get(m.Session)
if err != nil { if err != nil {
return err, "" return err, ""
} }
@ -89,7 +89,7 @@ func (m SessionModule) StringParam(name string) (error, string) {
} }
func (m SessionModule) IPParam(name string) (error, net.IP) { func (m SessionModule) IPParam(name string) (error, net.IP) {
err, v := m.StringParam(name); err, v := m.StringParam(name)
if err != nil { if err != nil {
return err, nil return err, nil
} }
@ -97,9 +97,9 @@ func (m SessionModule) IPParam(name string) (error, net.IP) {
} }
func (m SessionModule) IntParam(name string) (error, int) { func (m SessionModule) IntParam(name string) (error, int) {
p, found := m.params[name]; p, found := m.params[name]
if found { if found {
err, v := p.Get(m.Session); err, v := p.Get(m.Session)
if err != nil { if err != nil {
return err, 0 return err, 0
} }
@ -109,7 +109,7 @@ func (m SessionModule) IntParam(name string) (error, int) {
} }
func (m SessionModule) BoolParam(name string) (error, bool) { func (m SessionModule) BoolParam(name string) (error, bool) {
err, v := m.params[name].Get(m.Session); err, v := m.params[name].Get(m.Session)
if err != nil { if err != nil {
return err, false return err, false
} }

View file

@ -119,7 +119,7 @@ func New() (*Session, error) {
} }
if *s.Options.CpuProfile != "" { if *s.Options.CpuProfile != "" {
f, err := os.Create(*s.Options.CpuProfile); f, err := os.Create(*s.Options.CpuProfile)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -162,7 +162,7 @@ func (s *Session) exitHandler(args []string, sess *Session) error {
} }
func (s *Session) sleepHandler(args []string, sess *Session) error { func (s *Session) sleepHandler(args []string, sess *Session) error {
secs, err := strconv.Atoi(args[0]); secs, err := strconv.Atoi(args[0])
if err == nil { if err == nil {
time.Sleep(time.Duration(secs) * time.Second) time.Sleep(time.Duration(secs) * time.Second)
} }

View file

@ -74,7 +74,7 @@ func ParseCommands(line string) []string {
func (s *Session) parseEnvTokens(str string) (string, error) { func (s *Session) parseEnvTokens(str string) (string, error) {
for _, m := range reEnvVarCapture.FindAllString(str, -1) { for _, m := range reEnvVarCapture.FindAllString(str, -1) {
varName := strings.Trim(strings.Replace(m, "env.", "", -1), "{}") varName := strings.Trim(strings.Replace(m, "env.", "", -1), "{}")
found, value := s.Env.Get(varName); found, value := s.Env.Get(varName)
if !found { if !found {
return "", fmt.Errorf("variable '%s' is not defined", varName) return "", fmt.Errorf("variable '%s' is not defined", varName)
} }