Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
1
Task/Nested-templated-data/Go/nested-templated-data-1.go
Normal file
1
Task/Nested-templated-data/Go/nested-templated-data-1.go
Normal file
|
|
@ -0,0 +1 @@
|
|||
{{index .P n}}
|
||||
36
Task/Nested-templated-data/Go/nested-templated-data-2.go
Normal file
36
Task/Nested-templated-data/Go/nested-templated-data-2.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
func main() {
|
||||
const t = `[[[{{index .P 1}}, {{index .P 2}}],
|
||||
[{{index .P 3}}, {{index .P 4}}, {{index .P 1}}],
|
||||
{{index .P 5}}]]
|
||||
`
|
||||
type S struct {
|
||||
P map[int]string
|
||||
}
|
||||
|
||||
var s S
|
||||
s.P = map[int]string{
|
||||
0: "'Payload#0'", 1: "'Payload#1'", 2: "'Payload#2'", 3: "'Payload#3'",
|
||||
4: "'Payload#4'", 5: "'Payload#5'", 6: "'Payload#6'",
|
||||
}
|
||||
tmpl := template.Must(template.New("").Parse(t))
|
||||
tmpl.Execute(os.Stdout, s)
|
||||
|
||||
var unused []int
|
||||
for k, _ := range s.P {
|
||||
if !strings.Contains(t, fmt.Sprintf("{{index .P %d}}", k)) {
|
||||
unused = append(unused, k)
|
||||
}
|
||||
}
|
||||
sort.Ints(unused)
|
||||
fmt.Println("\nThe unused payloads have indices of :", unused)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue