Browse Source

err.Error() => err

(in main sources) return/log.Fatal => panic
pull/533/head
Xavier Petit 4 years ago committed by xpetit
parent
commit
fa02c0948e
  1. 2
      tests/go/cat_test.go
  2. 7
      tests/go/solutions/cat/main.go
  3. 2
      tests/go/solutions/displayfile/main.go
  4. 2
      tests/go/solutions/raid3/raid1aProg/raid1a.go
  5. 2
      tests/go/solutions/raid3/raid1bProg/raid1b.go
  6. 2
      tests/go/solutions/raid3/raid1cProg/raid1c.go
  7. 2
      tests/go/solutions/raid3/raid1dProg/raid1d.go
  8. 2
      tests/go/solutions/raid3/raid1eProg/raid1e.go
  9. 2
      tests/go/solutions/range/main.go
  10. 2
      tests/go/solutions/reverserange/main.go
  11. 2
      tests/go/solutions/ztail/main.go

2
tests/go/cat_test.go

@ -49,7 +49,7 @@ func TestCat(t *testing.T) {
pwd, err := os.Getwd()
if err != nil {
t.Fatalf(err.Error())
t.Fatalf(err)
}
for i := 0; i < 2; i++ {

7
tests/go/solutions/cat/main.go

@ -1,10 +1,8 @@
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
)
@ -12,14 +10,13 @@ func main() {
size := len(os.Args)
if size == 1 {
if _, err := io.Copy(os.Stdout, os.Stdin); err != nil {
log.Fatal(err)
panic(err)
}
} else {
for i := 1; i < size; i++ {
data, err := ioutil.ReadFile(os.Args[i])
if err != nil {
fmt.Println(err.Error())
return
panic(err)
}
fmt.Print(string(data))
}

2
tests/go/solutions/displayfile/main.go

@ -20,7 +20,7 @@ func main() {
data, err := ioutil.ReadFile(fileName)
if err != nil {
fmt.Println(err.Error())
fmt.Println(err)
return
}

2
tests/go/solutions/raid3/raid1aProg/raid1a.go

@ -14,7 +14,7 @@ func main() {
secundArg, err2 := strconv.Atoi(os.Args[2])
if err != nil || err2 != nil {
fmt.Println(err.Error())
fmt.Println(err)
}
solutions.Raid1a(firstArg, secundArg)
} else {

2
tests/go/solutions/raid3/raid1bProg/raid1b.go

@ -14,7 +14,7 @@ func main() {
secundArg, err2 := strconv.Atoi(os.Args[2])
if err != nil || err2 != nil {
fmt.Println(err.Error())
fmt.Println(err)
}
solutions.Raid1b(firstArg, secundArg)
} else {

2
tests/go/solutions/raid3/raid1cProg/raid1c.go

@ -14,7 +14,7 @@ func main() {
secundArg, err2 := strconv.Atoi(os.Args[2])
if err != nil || err2 != nil {
fmt.Println(err.Error())
fmt.Println(err)
}
solutions.Raid1c(firstArg, secundArg)
} else {

2
tests/go/solutions/raid3/raid1dProg/raid1d.go

@ -14,7 +14,7 @@ func main() {
secundArg, err2 := strconv.Atoi(os.Args[2])
if err != nil || err2 != nil {
fmt.Println(err.Error())
fmt.Println(err)
}
solutions.Raid1d(firstArg, secundArg)
} else {

2
tests/go/solutions/raid3/raid1eProg/raid1e.go

@ -14,7 +14,7 @@ func main() {
secundArg, err2 := strconv.Atoi(os.Args[2])
if err != nil || err2 != nil {
fmt.Println(err.Error())
fmt.Println(err)
}
solutions.Raid1e(firstArg, secundArg)
} else {

2
tests/go/solutions/range/main.go

@ -14,7 +14,7 @@ func main() {
secondArg, err = strconv.Atoi(os.Args[2])
}
if err != nil {
fmt.Println(err.Error())
fmt.Println(err)
return
}
fmt.Println(rangeOf(firstArg, secondArg))

2
tests/go/solutions/reverserange/main.go

@ -14,7 +14,7 @@ func main() {
secondArg, err = strconv.Atoi(os.Args[2])
}
if err != nil {
fmt.Println(err.Error())
fmt.Println(err)
return
}
fmt.Println(reverseRange(firstArg, secondArg))

2
tests/go/solutions/ztail/main.go

@ -42,7 +42,7 @@ func fileSize(fi *os.File) int64 {
fil, err := fi.Stat()
if err != nil {
fmt.Println(err.Error())
fmt.Println(err)
return 0
}

Loading…
Cancel
Save