terraform/internal/lang/funcs
Martin Atkins e95f29bf9d lang/funcs: fileexists slightly better "not a file" error message
Previously we were just returning a string representation of the file mode,
which spends more characters on the irrelevant permission bits that it
does on the directory entry type, and is presented in a Unix-centric
format that likely won't be familiar to the user of a Windows system.

Instead, we'll recognize a few specific directory entry types that seem
worth mentioning by name, and then use a generic message for the rest.

The original motivation here was actually to deal with the fact that our
tests for this function were previously not portable due to the error
message leaking system-specific permission detail that are not relevant
to the test. Rather than just directly addressing that portability
problem, I took the opportunity to improve the error messages at the same
time.

However, because of that initial focus there are only actually tests here
for the directory case. A test that tries to test any of these other file
modes would not be portable and in some cases would require superuser
access, so we'll just leave those cases untested for the moment since they
weren't tested before anyway, and so we've not _lost_ any test coverage
here.
2022-01-11 08:46:29 -08:00
..
testdata lang: Redact sensitive values from function errors 2021-12-03 09:46:57 -05:00
cidr.go lang/funcs: Preserve IP address leading zero behavior from Go 1.16 2021-08-17 15:20:05 -07:00
cidr_test.go build: Run staticcheck with "go run" 2021-10-12 11:42:17 -07:00
collection.go lang: Redact sensitive values from function errors 2021-12-03 09:46:57 -05:00
collection_test.go lang: Redact sensitive values from function errors 2021-12-03 09:46:57 -05:00
conversion.go add marks.Raw 2021-06-25 14:27:43 -04:00
conversion_test.go remove IsMarked and ContainsMarked calls 2021-06-25 14:17:06 -04:00
crypto.go funcs: defer close file in funcs 2021-11-16 09:25:49 +01:00
crypto_test.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
datetime.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
datetime_test.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
defaults.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
defaults_test.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
encoding.go lang: Redact sensitive values from function errors 2021-12-03 09:46:57 -05:00
encoding_test.go lang: Redact sensitive values from function errors 2021-12-03 09:46:57 -05:00
filesystem.go lang/funcs: fileexists slightly better "not a file" error message 2022-01-11 08:46:29 -08:00
filesystem_test.go lang/funcs: fileexists slightly better "not a file" error message 2022-01-11 08:46:29 -08:00
number.go lang: Redact sensitive values from function errors 2021-12-03 09:46:57 -05:00
number_test.go lang: Redact sensitive values from function errors 2021-12-03 09:46:57 -05:00
redact.go lang: Redact sensitive values from function errors 2021-12-03 09:46:57 -05:00
redact_test.go lang: Redact sensitive values from function errors 2021-12-03 09:46:57 -05:00
sensitive.go marks package 2021-06-25 12:35:51 -04:00
sensitive_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
string.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00
string_test.go Move lang/ to internal/lang/ 2021-05-17 14:09:07 -07:00