Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ksakae1216
Created July 2, 2018 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksakae1216/5d34abe64c6a932296cbfe435c7b52f0 to your computer and use it in GitHub Desktop.
Save ksakae1216/5d34abe64c6a932296cbfe435c7b52f0 to your computer and use it in GitHub Desktop.
package funcpkg
import (
"fmt"
"os"
)
// ErrHundleFunc エラー処理のサンプルです
func ErrHundleFunc() {
// 標準関数はほとんどが2つ目の戻り値にエラー情報を返します。
file, err := os.Open("dummy.txt")
if err != nil {
fmt.Println("ファイルOPENエラー -> ", err)
} else {
fmt.Println("ファイルOPEN -> ", file)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment