Skip to content

Commit

Permalink
apply go fmt to code
Browse files Browse the repository at this point in the history
  • Loading branch information
julsemaan committed Sep 11, 2018
1 parent 539b34d commit ef332cc
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 42 deletions.
24 changes: 12 additions & 12 deletions certificate.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package main

import (
"os"
"io"
"log"
"syscall"
"strings"
"io"
"log"
"os"
"strings"
"syscall"

"os/exec"
"encoding/hex"
"crypto/sha1"
"crypto/sha1"
"encoding/hex"
"os/exec"

"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
)

// Get CA fingerprint
Expand Down Expand Up @@ -60,7 +60,7 @@ func addCertToMachine(userCertDecode string, CERTUTIL_PROGRAM_PATH string) error
ERROR_FILE_NOT_FOUND = 2147942402

if userCertDecode != "" {
var badCertificatePassword = true
var badCertificatePassword = true
for badCertificatePassword {
badCertificatePassword = false

Expand All @@ -73,7 +73,7 @@ func addCertToMachine(userCertDecode string, CERTUTIL_PROGRAM_PATH string) error
MinSize: Size{350, 100},
Layout: VBox{},
Children: []Widget{
Label{Text: T("enterCertificatePassword")},
Label{Text: T("enterCertificatePassword")},
LineEdit{AssignTo: &passwordTE, PasswordMode: true},
PushButton{
Text: "OK",
Expand Down
30 changes: 15 additions & 15 deletions hide_console.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package main

import (
"github.com/gonutz/ide/w32"
"github.com/gonutz/ide/w32"
)

func hideConsole() {
console := w32.GetConsoleWindow()
if console == 0 {
return // no console attached
}
// If this application is the process that created the console window, then
// this program was not compiled with the -H=windowsgui flag and on start-up
// it created a console along with the main application window. In this case
// hide the console window.
// See
// http://stackoverflow.com/questions/9009333/how-to-check-if-the-program-is-run-from-a-console
_, consoleProcID := w32.GetWindowThreadProcessId(console)
if w32.GetCurrentProcessId() == consoleProcID {
w32.ShowWindowAsync(console, w32.SW_HIDE)
}
console := w32.GetConsoleWindow()
if console == 0 {
return // no console attached
}
// If this application is the process that created the console window, then
// this program was not compiled with the -H=windowsgui flag and on start-up
// it created a console along with the main application window. In this case
// hide the console window.
// See
// http://stackoverflow.com/questions/9009333/how-to-check-if-the-program-is-run-from-a-console
_, consoleProcID := w32.GetWindowThreadProcessId(console)
if w32.GetCurrentProcessId() == consoleProcID {
w32.ShowWindowAsync(console, w32.SW_HIDE)
}
}
6 changes: 3 additions & 3 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"io/ioutil"
"net/http"
"os/exec"
"text/template"
"path/filepath"
"text/template"

"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
Expand Down Expand Up @@ -117,7 +117,7 @@ func main() {
log.Fatal("Failed opening main window: ", err)
os.Exit(1)
}
os.Remove(tempPath +"\\"+ "pf_bg.png")
os.Remove(tempPath + "\\" + "pf_bg.png")
os.Exit(0)
}

Expand Down Expand Up @@ -228,7 +228,7 @@ func Configure() {
default:
walk.MsgBox(windowMsgBox, T("errorWindowTitle"), T("Unexpected PayloadType {{.PayloadType}} please contact your local support.", map[string]interface{}{
"PayloadType": payloadType,
}), walk.MsgBoxOK)
}), walk.MsgBoxOK)
log.Fatal("Unexpected PayloadType: ", payloadType)
os.Exit(1)
}
Expand Down
24 changes: 12 additions & 12 deletions utils.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package main

import (
"strings"
"os"
"log"
"io"
"image"
"image"
"io"
"log"
"os"
"strings"

"image/png"
"encoding/base64"
"encoding/base64"
"image/png"

"github.com/tink-ab/tempfile"
"github.com/lxn/walk"
"github.com/lxn/walk"
"github.com/tink-ab/tempfile"
)

// Create and write profile file into templateToFile folder
Expand Down Expand Up @@ -54,12 +54,12 @@ func base64ToPng(BACKGROUND_IMAGE_PF, tempPath string) (error, string) {
err = png.Encode(backgroundFile, decodeBase64ToPng)
if err != nil {
log.Fatal(err)
os.Remove(pngFilePath)
os.Remove(pngFilePath)
return err, pngFilename
}
log.Println("PNG file", pngFilename, "successfully created.")
backgroundFile.Close()
return nil, pngFilename
backgroundFile.Close()
return nil, pngFilename
}

// Decode base64 certificate to string
Expand Down

0 comments on commit ef332cc

Please sign in to comment.