diff --git a/main.go b/main.go index 4218595..4d0113f 100644 --- a/main.go +++ b/main.go @@ -125,7 +125,9 @@ type file interface { // replaced by testing functions. var openFile = func(name string) (file, error) { - return os.OpenFile(name, os.O_RDWR, 0666) + // The permission bits (third argument) are only used when O_CREATE is set. + // Since we only open existing files, 0 is passed to make that clear. + return os.OpenFile(name, os.O_RDWR, 0) } func processFile(path string, rewrite, doDiff bool) (foundDiff bool, err error) { diff --git a/main_test.go b/main_test.go index 76c4bb7..3bbba5a 100644 --- a/main_test.go +++ b/main_test.go @@ -5,7 +5,7 @@ // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to writing, software distributed -// under the License is distributed on a "AS IS" BASIS, WITHOUT WARRANTIES OR +// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and @@ -120,7 +120,6 @@ func TestEmbedFiles(t *testing.T) { if got := f.buf.String(); tt.out != got { t.Errorf("case [%s]: expected output \n%q; got\n%q", tt.name, tt.out, got) } - } }