"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tpl/internal/go_templates/texttemplate/examplefiles_test.go" between
hugo-0.80.0.tar.gz and hugo-0.81.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

examplefiles_test.go  (hugo-0.80.0):examplefiles_test.go  (hugo-0.81.0)
// Copyright 2012 The Go Authors. All rights reserved. // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build go1.13 // +build go1.13
package template_test package template_test
import ( import (
"io" "io"
"io/ioutil"
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
"text/template" "text/template"
) )
// templateFile defines the contents of a template to be stored in a file, for t esting. // templateFile defines the contents of a template to be stored in a file, for t esting.
type templateFile struct { type templateFile struct {
name string name string
contents string contents string
} }
func createTestDir(files []templateFile) string { func createTestDir(files []templateFile) string {
dir, err := ioutil.TempDir("", "template") dir, err := os.MkdirTemp("", "template")
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
for _, file := range files { for _, file := range files {
f, err := os.Create(filepath.Join(dir, file.name)) f, err := os.Create(filepath.Join(dir, file.name))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
defer f.Close() defer f.Close()
_, err = io.WriteString(f, file.contents) _, err = io.WriteString(f, file.contents)
 End of changes. 2 change blocks. 
2 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)