1
0
mirror of https://github.com/golang/go synced 2024-11-18 06:14:46 -07:00

Fix doc in cmd/internal/diff/diff, remove unused param 'dir' in writeTempFile

This commit is contained in:
Mikhail Fesenko 2019-10-28 23:13:46 +03:00
parent 3fde01fbb6
commit 02a3aa1a32
No known key found for this signature in database
GPG Key ID: EFF13E9E31D0464E

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package diff implements Diff function that compares two []byte
// using 'diff' tool.
// Package diff implements a Diff function that compare two inputs
// using the 'diff' tool.
package diff
import (
@ -15,13 +15,13 @@ import (
// Returns diff of two arrays of bytes in diff tool format.
func Diff(prefix string, b1, b2 []byte) ([]byte, error) {
f1, err := writeTempFile("", prefix, b1)
f1, err := writeTempFile(prefix, b1)
if err != nil {
return nil, err
}
defer os.Remove(f1)
f2, err := writeTempFile("", prefix, b2)
f2, err := writeTempFile(prefix, b2)
if err != nil {
return nil, err
}
@ -41,8 +41,8 @@ func Diff(prefix string, b1, b2 []byte) ([]byte, error) {
return data, err
}
func writeTempFile(dir, prefix string, data []byte) (string, error) {
file, err := ioutil.TempFile(dir, prefix)
func writeTempFile(prefix string, data []byte) (string, error) {
file, err := ioutil.TempFile("", prefix)
if err != nil {
return "", err
}