1
0
mirror of https://github.com/byReqz/go-etcher.git synced 2025-04-08 06:16:48 +00:00

Compare commits

..

No commits in common. "d0f0957932eaa793e890451e9e9f3b5d8b5b40fa" and "947660b7733a4d062d9fc14d8929ea5216b05510" have entirely different histories.

2 changed files with 23 additions and 31 deletions

View File

@ -1,7 +0,0 @@
name: ci
on: [push]
jobs:
test:
uses: byReqz/workflows/.github/workflows/golint_with_codeql.yml@main

29
main.go
View File

@ -1,20 +1,19 @@
package main package main
import ( import (
"crypto/sha256"
"fmt" "fmt"
ac "github.com/JoaoDanielRufino/go-input-autocomplete"
"github.com/briandowns/spinner"
"github.com/fatih/color"
"github.com/schollz/progressbar/v3"
flag "github.com/spf13/pflag"
"io"
"log"
"os" "os"
"io"
"time"
"log"
"strings"
"runtime" "runtime"
"strconv" "strconv"
"strings" "crypto/sha256"
"time" "github.com/schollz/progressbar/v3"
"github.com/fatih/color"
"github.com/briandowns/spinner"
flag "github.com/spf13/pflag"
ac "github.com/JoaoDanielRufino/go-input-autocomplete"
) )
var device string var device string
@ -180,7 +179,7 @@ func main() {
inputsize = statinput.Size() inputsize = statinput.Size()
inputisblock = false inputisblock = false
} else { } else {
inputsize, _ = image.Seek(0, io.SeekEnd) inputsize, err = image.Seek(0, io.SeekEnd)
inputisblock = true inputisblock = true
_, _ = image.Seek(0, 0) _, _ = image.Seek(0, 0)
} }
@ -223,19 +222,19 @@ func main() {
devicemb := fmt.Sprint("[", targetsize / 1024 / 1024, "MB]") devicemb := fmt.Sprint("[", targetsize / 1024 / 1024, "MB]")
var inputblock string var inputblock string
var targetblock string var targetblock string
if inputisblock { if inputisblock == true {
inputblock = "[Blockdevice]" inputblock = "[Blockdevice]"
} else { } else {
inputblock = "[File]" inputblock = "[File]"
} }
if targetisblock { if targetisblock == true {
targetblock = "[Blockdevice]" targetblock = "[Blockdevice]"
} else { } else {
targetblock = "[File]" targetblock = "[File]"
} }
fmt.Println("[", color.BlueString("i"), "] Input device/file: " + input, inputmb, inputblock) fmt.Println("[", color.BlueString("i"), "] Input device/file: " + input, inputmb, inputblock)
fmt.Println("[", color.BlueString("i"), "] Output device/file: " + device, devicemb, targetblock) fmt.Println("[", color.BlueString("i"), "] Output device/file: " + device, devicemb, targetblock)
if !force { if force == false {
if inputsize > targetsize { if inputsize > targetsize {
fmt.Println("[", color.RedString("w"), "]", color.RedString(" Warning:"), "Input file seems to be bigger than the destination!") fmt.Println("[", color.RedString("w"), "]", color.RedString(" Warning:"), "Input file seems to be bigger than the destination!")
} }