44 lines
688 B
Plaintext
44 lines
688 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,go]
|
|
----
|
|
file, err := os.Open("accounts.txt") // Noncompliant
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
bs, err := ioutil.ReadFile("accounts.txt") // Noncompliant
|
|
if err != nil {
|
|
return
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
[source,go]
|
|
----
|
|
var location string = prop.Read("myApplication.mySpecificFile")
|
|
file, err := os.Open(location)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|