53 lines
796 B
Plaintext
53 lines
796 B
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
== How to fix it
|
|
|
|
include::../how-to-fix-it.adoc[]
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,go,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
func compute(start int) { // Noncompliant; start is not used
|
|
sum := 0
|
|
for i := 0; i < 10; i++ {
|
|
sum += i
|
|
}
|
|
fmt.Println("Result:", sum)
|
|
}
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,go,diff-id=1,diff-type=compliant]
|
|
----
|
|
func compute() {
|
|
sum := 0
|
|
for i := 0; i < 10; i++ {
|
|
sum += i
|
|
}
|
|
fmt.Println("Result:", sum)
|
|
}
|
|
----
|
|
|
|
|
|
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[]
|