From 6394bf32ee3cc1fa74259f9366b4616276485acf Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 4 Aug 2017 23:57:58 +0200 Subject: Less clutter --- b64file/file.go | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'b64file') diff --git a/b64file/file.go b/b64file/file.go index 9254303..6f5dd28 100644 --- a/b64file/file.go +++ b/b64file/file.go @@ -10,7 +10,6 @@ import ( "fmt" "io" "io/ioutil" - "os" "strings" ) @@ -19,15 +18,6 @@ const untrusted = "untrusted comment: " // Original Error: "invalid comment in %s; must start with 'untrusted comment: '" var ErrUntrusted = errors.New("comment must start with 'untrusted comment: '") -func DecodeFile(fname string, u encoding.BinaryUnmarshaler) (string, []byte, error) { - fd, err := os.Open(fname) - if err != nil { - return "", nil, err - } - defer fd.Close() - return Decode(fd, u) -} - func DecodeString(data string, u encoding.BinaryUnmarshaler) (string, []byte, error) { r := strings.NewReader(data) return Decode(r, u) @@ -70,15 +60,6 @@ func Decode(r io.Reader, u encoding.BinaryUnmarshaler) (string, []byte, error) { return comment, message, nil } -func EncodeFile(fname string, perm os.FileMode, u encoding.BinaryMarshaler, comment string, msg []byte) error { - fd, err := os.OpenFile(fname, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm) - if err != nil { - return err - } - defer fd.Close() - return Encode(fd, u, comment, msg) -} - func Encode(w io.Writer, u encoding.BinaryMarshaler, comment string, msg []byte) error { raw, err := u.MarshalBinary() if err != nil { -- cgit v1.2.3