Hello community,
here is the log from the commit of package golang-github-hoisie-mustache for
openSUSE:Factory checked in at 2017-03-24 02:15:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/golang-github-hoisie-mustache (Old)
and /work/SRC/openSUSE:Factory/.golang-github-hoisie-mustache.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "golang-github-hoisie-mustache"
Fri Mar 24 02:15:43 2017 rev:2 rq:477172 version:0.0.0+git20160804.6375acf
Changes:
--------
---
/work/SRC/openSUSE:Factory/golang-github-hoisie-mustache/golang-github-hoisie-mustache.changes
2015-08-01 11:36:35.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.golang-github-hoisie-mustache.new/golang-github-hoisie-mustache.changes
2017-03-24 02:15:45.614104600 +0100
@@ -1,0 +2,7 @@
+Fri Jan 13 12:23:49 UTC 2017 - [email protected]
+
+- Update to 0.0.0+git20160804.6375acf
+- Refactoring based on new packaging proposal
+- Add rpmlintrc
+
+-------------------------------------------------------------------
Old:
----
mustache-0.0.0+git20141121.af524a1.tar.xz
New:
----
mustache-0.0.0+git20160804.6375acf.tar.xz
rpmlintrc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ golang-github-hoisie-mustache.spec ++++++
--- /var/tmp/diff_new_pack.HMtgBj/_old 2017-03-24 02:15:46.090037260 +0100
+++ /var/tmp/diff_new_pack.HMtgBj/_new 2017-03-24 02:15:46.094036694 +0100
@@ -1,7 +1,7 @@
#
-# spec file for package golang-github-hoisie-mustache
+# spec file for package golang
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2010 Sascha Peilicke <[email protected]>
#
# All modifications and additions to the file contributed by third parties
@@ -17,21 +17,31 @@
#
-Name: golang-github-hoisie-mustache
-Version: 0.0.0+git20141121.af524a1
+%global provider github
+%global provider_tld com
+%global project hoisie
+%global repo mustache
+%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
+%global import_path %{provider_prefix}
+
+Name: golang-%{provider}-%{project}-%{repo}
+Version: 0.0.0+git20160804.6375acf
Release: 0
Summary: The mustache template language in Go
License: MIT
Group: Development/Languages/Other
-Url: http://github.com/hoisie/mustache
-Source: mustache-%{version}.tar.xz
-BuildRequires: golang-packaging
-BuildRequires: xz
+Url: https://%{provider_prefix}
+Source0: %{repo}-%{version}.tar.xz
+Source1: rpmlintrc
Provides: go-mustache.go = %{version}
Obsoletes: go-mustache.go < %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-%{go_provides}
+BuildArch: noarch
+BuildRequires: golang-packaging
+BuildRequires: xz
+
+%{go_provides}
%description
mustache.go is an implementation of the mustache template language in Go. It
@@ -39,26 +49,20 @@
mustache.go is fast, it parses templates efficiently and stores them in a
tree-like structure which allows for fast execution.
-%gosrc_package
-
%prep
-%setup -q -n mustache-%{version}
+%setup -q -n %{repo}-%{version}
%build
-%goprep github.com/hoisie/mustache
-%gobuild
+%goprep %{import_path}
+%gobuild .
%install
%goinstall
%gosrc
+%gofilelist
-%files
+%files -f file.lst
%defattr(-,root,root,-)
%doc LICENSE Readme.md
-%{go_contribdir}/*
-
-%files source
-%defattr(-,root,root,-)
-%{go_contribsrcdir}/*
%changelog
++++++ mustache-0.0.0+git20141121.af524a1.tar.xz ->
mustache-0.0.0+git20160804.6375acf.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mustache-0.0.0+git20141121.af524a1/Readme.md
new/mustache-0.0.0+git20160804.6375acf/Readme.md
--- old/mustache-0.0.0+git20141121.af524a1/Readme.md 2015-07-25
19:17:47.000000000 +0200
+++ new/mustache-0.0.0+git20160804.6375acf/Readme.md 2016-08-05
01:50:33.000000000 +0200
@@ -14,29 +14,34 @@
## Usage
There are four main methods in this package:
- func Render(data string, context ...interface{}) string
-
- func RenderFile(filename string, context ...interface{}) string
-
- func ParseString(data string) (*Template, os.Error)
-
- func ParseFile(filename string) (*Template, os.Error)
+```go
+func Render(data string, context ...interface{}) string
+
+func RenderFile(filename string, context ...interface{}) string
+
+func ParseString(data string) (*Template, os.Error)
+
+func ParseFile(filename string) (*Template, os.Error)
+```
There are also two additional methods for using layouts (explained below).
The Render method takes a string and a data source, which is generally a map
or struct, and returns the output string. If the template file contains an
error, the return value is a description of the error. There's a similar
method, RenderFile, which takes a filename as an argument and uses that for the
template contents.
- data := mustache.Render("hello {{c}}", map[string]string{"c":"world"})
- println(data)
-
+```go
+data := mustache.Render("hello {{c}}", map[string]string{"c":"world"})
+println(data)
+```
If you're planning to render the same template multiple times, you do it
efficiently by compiling the template first:
- tmpl,_ := mustache.ParseString("hello {{c}}")
- var buf bytes.Buffer;
- for i := 0; i < 10; i++ {
- tmpl.Render (map[string]string { "c":"world"}, &buf)
- }
+```go
+tmpl,_ := mustache.ParseString("hello {{c}}")
+var buf bytes.Buffer;
+for i := 0; i < 10; i++ {
+ tmpl.Render (map[string]string { "c":"world"}, &buf)
+}
+```
For more example usage, please see `mustache_test.go`
@@ -48,56 +53,68 @@
It is a common pattern to include a template file as a "wrapper" for other
templates. The wrapper may include a header and a footer, for instance.
Mustache.go supports this pattern with the following two methods:
- func RenderInLayout(data string, layout string, context ...interface{})
string
-
- func RenderFileInLayout(filename string, layoutFile string, context
...interface{}) string
+```go
+func RenderInLayout(data string, layout string, context ...interface{}) string
+
+func RenderFileInLayout(filename string, layoutFile string, context
...interface{}) string
+```
The layout file must have a variable called `{{content}}`. For example, given
the following files:
layout.html.mustache:
- <html>
- <head><title>Hi</title></head>
- <body>
- {{{content}}}
- </body>
- </html>
+```html
+<html>
+<head><title>Hi</title></head>
+<body>
+{{{content}}}
+</body>
+</html>
+```
template.html.mustache:
- <h1> Hello World! </h1>
+```html
+<h1> Hello World! </h1>
+```
A call to `RenderFileInLayout("template.html.mustache",
"layout.html.mustache", nil)` will produce:
- <html>
- <head><title>Hi</title></head>
- <body>
- <h1> Hello World! </h1>
- </body>
- </html>
+```html
+<html>
+<head><title>Hi</title></head>
+<body>
+<h1> Hello World! </h1>
+</body>
+</html>
+```
## A note about method receivers
Mustache.go supports calling methods on objects, but you have to be aware of
Go's limitations. For example, lets's say you have the following type:
- type Person struct {
- FirstName string
- LastName string
- }
-
- func (p *Person) Name1() string {
- return p.FirstName + " " + p.LastName
- }
-
- func (p Person) Name2() string {
- return p.FirstName + " " + p.LastName
- }
+```go
+type Person struct {
+ FirstName string
+ LastName string
+}
+
+func (p *Person) Name1() string {
+ return p.FirstName + " " + p.LastName
+}
+
+func (p Person) Name2() string {
+ return p.FirstName + " " + p.LastName
+}
+```
While they appear to be identical methods, `Name1` has a pointer receiver, and
`Name2` has a value receiver. Objects of type `Person`(non-pointer) can only
access `Name2`, while objects of type `*Person`(person) can access both. This
is by design in the Go language.
So if you write the following:
- mustache.Render("{{Name1}}", Person{"John", "Smith"})
+```go
+mustache.Render("{{Name1}}", Person{"John", "Smith"})
+```
It'll be blank. You either have to use `&Person{"John", "Smith"}`, or call
`Name2`
@@ -108,5 +125,3 @@
* Change delimiter
* Sections (boolean, enumerable, and inverted)
* Partials
-
-
++++++ rpmlintrc ++++++
# We are aware of that but shorter names are not possible
addFilter("filename-too-long-for-joliet")