mirror of
https://github.com/golang/go
synced 2024-11-18 08:24:44 -07:00
Fix doc in cmd/internal/diff/diff, remove unused param 'dir' in writeTempFile
This commit is contained in:
parent
3fde01fbb6
commit
02a3aa1a32
@ -2,8 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package diff implements Diff function that compares two []byte
|
// Package diff implements a Diff function that compare two inputs
|
||||||
// using 'diff' tool.
|
// using the 'diff' tool.
|
||||||
package diff
|
package diff
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -15,13 +15,13 @@ import (
|
|||||||
|
|
||||||
// Returns diff of two arrays of bytes in diff tool format.
|
// Returns diff of two arrays of bytes in diff tool format.
|
||||||
func Diff(prefix string, b1, b2 []byte) ([]byte, error) {
|
func Diff(prefix string, b1, b2 []byte) ([]byte, error) {
|
||||||
f1, err := writeTempFile("", prefix, b1)
|
f1, err := writeTempFile(prefix, b1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer os.Remove(f1)
|
defer os.Remove(f1)
|
||||||
|
|
||||||
f2, err := writeTempFile("", prefix, b2)
|
f2, err := writeTempFile(prefix, b2)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -41,8 +41,8 @@ func Diff(prefix string, b1, b2 []byte) ([]byte, error) {
|
|||||||
return data, err
|
return data, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeTempFile(dir, prefix string, data []byte) (string, error) {
|
func writeTempFile(prefix string, data []byte) (string, error) {
|
||||||
file, err := ioutil.TempFile(dir, prefix)
|
file, err := ioutil.TempFile("", prefix)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user