Indent fixes gofmt

This commit is contained in:
Frikky
2025-10-26 14:38:01 +01:00
parent 97ef960bb0
commit ce1e932a88
2 changed files with 53 additions and 53 deletions
+13 -13
View File
@@ -14,18 +14,18 @@ import (
"crypto/md5" "crypto/md5"
"strconv" "strconv"
"os"
"io"
"log"
"fmt"
"errors"
"net/url"
"os/exec"
"net/http"
"io/ioutil"
"math/rand"
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"math/rand"
"net/http"
"net/url"
"os"
"os/exec"
"net/http/httptest" "net/http/httptest"
"strings" "strings"
@@ -67,6 +67,7 @@ var runningEnvironment = "onprem"
var syncUrl = "https://shuffler.io" var syncUrl = "https://shuffler.io"
var debug = false var debug = false
//var syncUrl = "http://localhost:5002" //var syncUrl = "http://localhost:5002"
type retStruct struct { type retStruct struct {
@@ -4503,7 +4504,6 @@ func runInitEs(ctx context.Context) {
continue continue
} }
respBody, err := ioutil.ReadAll(newresp.Body) respBody, err := ioutil.ReadAll(newresp.Body)
if err != nil { if err != nil {
log.Printf("[ERROR] Failed setting respbody %s for execution stop. Status: %d", err, newresp.StatusCode) log.Printf("[ERROR] Failed setting respbody %s for execution stop. Status: %d", err, newresp.StatusCode)
@@ -5052,7 +5052,7 @@ func handleCloudSetup(resp http.ResponseWriter, request *http.Request) {
Interval: responseData.IntervalSeconds, Interval: responseData.IntervalSeconds,
WorkflowBackup: true, WorkflowBackup: true,
AppBackup: true, AppBackup: true,
} }
interval := int(responseData.IntervalSeconds) interval := int(responseData.IntervalSeconds)
@@ -5675,7 +5675,7 @@ func initHandlers() {
r.HandleFunc("/api/v1/dashboards/{key}/widgets", shuffle.HandleNewWidget).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/dashboards/{key}/widgets", shuffle.HandleNewWidget).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/dashboards/{key}/widgets/{widget_id}", shuffle.HandleGetWidget).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/dashboards/{key}/widgets/{widget_id}", shuffle.HandleGetWidget).Methods("GET", "OPTIONS")
if (strings.ToLower(os.Getenv("SHUFFLE_DEBUG_MEMORY")) == "true" || strings.ToLower(os.Getenv("DEBUG_MEMORY")) == "true") { if strings.ToLower(os.Getenv("SHUFFLE_DEBUG_MEMORY")) == "true" || strings.ToLower(os.Getenv("DEBUG_MEMORY")) == "true" {
log.Printf("[DEBUG] Memory debugging is enabled on /debug/pprof") log.Printf("[DEBUG] Memory debugging is enabled on /debug/pprof")
r.HandleFunc("/debug/pprof/", pprof.Index) r.HandleFunc("/debug/pprof/", pprof.Index)
r.HandleFunc("/debug/pprof/heap", pprof.Handler("heap").ServeHTTP) r.HandleFunc("/debug/pprof/heap", pprof.Handler("heap").ServeHTTP)
+20 -20
View File
@@ -20,21 +20,21 @@ import (
"strings" "strings"
"time" "time"
dockerclient "github.com/docker/docker/client"
"github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/image"
dockerclient "github.com/docker/docker/client"
"github.com/h2non/filetype" "github.com/h2non/filetype"
uuid "github.com/satori/go.uuid" uuid "github.com/satori/go.uuid"
newscheduler "github.com/carlescere/scheduler" newscheduler "github.com/carlescere/scheduler"
"github.com/go-co-op/gocron"
"github.com/frikky/kin-openapi/openapi3" "github.com/frikky/kin-openapi/openapi3"
gyaml "github.com/ghodss/yaml"
"github.com/go-co-op/gocron"
"github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5"
"github.com/go-git/go-billy/v5/memfs" "github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/storage/memory"
"github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing"
http2 "github.com/go-git/go-git/v5/plumbing/transport/http" http2 "github.com/go-git/go-git/v5/plumbing/transport/http"
gyaml "github.com/ghodss/yaml" "github.com/go-git/go-git/v5/storage/memory"
) )
var localBase = "http://localhost:5001" var localBase = "http://localhost:5001"
@@ -457,16 +457,16 @@ func handleGetWorkflowExecutionResult(resp http.ResponseWriter, request *http.Re
if workflowExecution.Workflow.Sharing == "form" { if workflowExecution.Workflow.Sharing == "form" {
newWorkflow := shuffle.Workflow{ newWorkflow := shuffle.Workflow{
Name: workflowExecution.Workflow.Name, Name: workflowExecution.Workflow.Name,
ID: workflowExecution.Workflow.ID, ID: workflowExecution.Workflow.ID,
Owner: workflowExecution.Workflow.Owner, Owner: workflowExecution.Workflow.Owner,
OrgId: workflowExecution.Workflow.OrgId, OrgId: workflowExecution.Workflow.OrgId,
Sharing: workflowExecution.Workflow.Sharing, Sharing: workflowExecution.Workflow.Sharing,
Description: workflowExecution.Workflow.Description, Description: workflowExecution.Workflow.Description,
InputQuestions: workflowExecution.Workflow.InputQuestions, InputQuestions: workflowExecution.Workflow.InputQuestions,
FormControl: workflowExecution.Workflow.FormControl, FormControl: workflowExecution.Workflow.FormControl,
} }
workflowExecution.Results = []shuffle.ActionResult{} workflowExecution.Results = []shuffle.ActionResult{}
@@ -765,7 +765,7 @@ func deleteWorkflow(resp http.ResponseWriter, request *http.Request) {
} }
if user.Id != workflow.Owner || len(user.Id) == 0 { if user.Id != workflow.Owner || len(user.Id) == 0 {
if workflow.OrgId == user.ActiveOrg.Id { if workflow.OrgId == user.ActiveOrg.Id {
log.Printf("[INFO] User %s is deleting workflow %s as admin. Owner: %s", user.Username, workflow.ID, workflow.Owner) log.Printf("[INFO] User %s is deleting workflow %s as admin. Owner: %s", user.Username, workflow.ID, workflow.Owner)
} else { } else {
log.Printf("[WARNING] Wrong user (%s) for workflow %s (delete workflow)", user.Username, workflow.ID) log.Printf("[WARNING] Wrong user (%s) for workflow %s (delete workflow)", user.Username, workflow.ID)
@@ -898,10 +898,10 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
} }
/* /*
if !workflow.IsValid { if !workflow.IsValid {
log.Printf("[ERROR] Stopped execution as workflow %s is not valid.", workflow.ID) log.Printf("[ERROR] Stopped execution as workflow %s is not valid.", workflow.ID)
return shuffle.WorkflowExecution{}, fmt.Sprintf(`workflow %s is invalid`, workflow.ID), errors.New("Failed getting workflow") return shuffle.WorkflowExecution{}, fmt.Sprintf(`workflow %s is invalid`, workflow.ID), errors.New("Failed getting workflow")
} }
*/ */
maxExecutionDepth := 10 maxExecutionDepth := 10
@@ -1337,7 +1337,7 @@ func stopSchedule(resp http.ResponseWriter, request *http.Request) {
} }
if user.Id != workflow.Owner || len(user.Id) == 0 { if user.Id != workflow.Owner || len(user.Id) == 0 {
if workflow.OrgId == user.ActiveOrg.Id { if workflow.OrgId == user.ActiveOrg.Id {
log.Printf("[AUDIT] User %s is accessing workflow %s as admin (stop schedule)", user.Username, workflow.ID) log.Printf("[AUDIT] User %s is accessing workflow %s as admin (stop schedule)", user.Username, workflow.ID)
} else { } else {
log.Printf("[WARNING] Wrong user (%s) for workflow %s (stop schedule)", user.Username, workflow.ID) log.Printf("[WARNING] Wrong user (%s) for workflow %s (stop schedule)", user.Username, workflow.ID)
@@ -1582,7 +1582,7 @@ func scheduleWorkflow(resp http.ResponseWriter, request *http.Request) {
} }
if user.Id != workflow.Owner || len(user.Id) == 0 { if user.Id != workflow.Owner || len(user.Id) == 0 {
if workflow.OrgId == user.ActiveOrg.Id { if workflow.OrgId == user.ActiveOrg.Id {
log.Printf("[INFO] User %s is deleting workflow %s as admin. Owner: %s", user.Username, workflow.ID, workflow.Owner) log.Printf("[INFO] User %s is deleting workflow %s as admin. Owner: %s", user.Username, workflow.ID, workflow.Owner)
} else { } else {
log.Printf("[WARNING] Wrong user (%s) for workflow %s (schedule start). Owner: %s", user.Username, workflow.ID, workflow.Owner) log.Printf("[WARNING] Wrong user (%s) for workflow %s (schedule start). Owner: %s", user.Username, workflow.ID, workflow.Owner)
@@ -2022,7 +2022,7 @@ func loadGithubWorkflows(url, username, password, userId, branch, orgId string)
cloneOptions.ReferenceName = plumbing.ReferenceName(branch) cloneOptions.ReferenceName = plumbing.ReferenceName(branch)
} }
cloneOptions = checkGitProxy(cloneOptions) cloneOptions = checkGitProxy(cloneOptions)
storer := memory.NewStorage() storer := memory.NewStorage()
r, err := git.Clone(storer, fs, cloneOptions) r, err := git.Clone(storer, fs, cloneOptions)
@@ -2923,7 +2923,7 @@ func executeSingleAction(resp http.ResponseWriter, request *http.Request) {
go shuffle.IncrementCache(ctx, workflowExecution.OrgId, "workflow_executions") go shuffle.IncrementCache(ctx, workflowExecution.OrgId, "workflow_executions")
executionRequest := shuffle.ExecutionRequest{ executionRequest := shuffle.ExecutionRequest{
Priority: 15, Priority: 15,
ExecutionId: workflowExecution.ExecutionId, ExecutionId: workflowExecution.ExecutionId,
WorkflowId: workflowExecution.Workflow.ID, WorkflowId: workflowExecution.Workflow.ID,
Authorization: workflowExecution.Authorization, Authorization: workflowExecution.Authorization,
@@ -3493,7 +3493,7 @@ func LoadSpecificApps(resp http.ResponseWriter, request *http.Request) {
} }
} }
cloneOptions = checkGitProxy(cloneOptions) cloneOptions = checkGitProxy(cloneOptions)
storer := memory.NewStorage() storer := memory.NewStorage()
r, err := git.Clone(storer, fs, cloneOptions) r, err := git.Clone(storer, fs, cloneOptions)