summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2021-12-23 13:50:41 +1100
committerCommit Bot <commit-bot@chromium.org>2022-01-06 03:39:47 +0000
commit318dcc1cf3540c2ab3092a10aee57c12cebd73e9 (patch)
tree31ff5fa21a98cfcaf47ebc7068abddaaa3646d1a
parent70b25d4b1bd667c4d7039aed15cb5966beab9848 (diff)
downloadchrome-ec-318dcc1cf3540c2ab3092a10aee57c12cebd73e9.tar.gz
pinmap: Use correct year for copyright
Use the current time to generate the correct year for the copyright header. BUG=b:211717378 TEST=go test BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: If787c8553eb1fd9b32277364c99bfd4489f22699 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3354261 Reviewed-by: Eizan Miyamoto <eizan@chromium.org> Commit-Queue: Eizan Miyamoto <eizan@chromium.org>
-rw-r--r--util/pinmap/pm/generate.go8
-rw-r--r--util/pinmap/pm/generate_test.go6
2 files changed, 8 insertions, 6 deletions
diff --git a/util/pinmap/pm/generate.go b/util/pinmap/pm/generate.go
index 6a4c3cce24..b4d384ac2a 100644
--- a/util/pinmap/pm/generate.go
+++ b/util/pinmap/pm/generate.go
@@ -9,10 +9,10 @@ import (
"io"
"sort"
"strings"
+ "time"
)
-// TODO(b/211717378): Fix the date handling
-const header = `/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+const header = `/* Copyright %d The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -25,8 +25,8 @@ const header = `/* Copyright 2021 The Chromium OS Authors. All rights reserved.
// Generate creates the DTS configuration from the pins using the chip as a
// reference and writes the DTS to the output.
func Generate(out io.Writer, pins *Pins, chip Chip) {
- // Write header
- fmt.Fprintf(out, "%s", header)
+ // Write header with date.
+ fmt.Fprintf(out, header, time.Now().Year())
pinConfig(out, "named-adc-channels", pins.Adc, chip, adcConfig)
pinConfig(out, "named-gpios", pins.Gpio, chip, gpioConfig)
pinConfig(out, "named-i2c-ports", pins.I2c, chip, i2cConfig)
diff --git a/util/pinmap/pm/generate_test.go b/util/pinmap/pm/generate_test.go
index 79997e7fcc..085ca68218 100644
--- a/util/pinmap/pm/generate_test.go
+++ b/util/pinmap/pm/generate_test.go
@@ -10,6 +10,7 @@ import (
"bytes"
"fmt"
"strings"
+ "time"
"pinmap/pm"
)
@@ -65,8 +66,8 @@ func TestGenerate(t *testing.T) {
* to parse the device tree directly and ensuing it is correct.
* However this would considerably complicate this test.
*/
- exp :=
- `/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ expFmt :=
+ `/* Copyright %d The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -135,6 +136,7 @@ func TestGenerate(t *testing.T) {
status = "okay";
};
`
+ exp := fmt.Sprintf(expFmt, time.Now().Year())
got := out.String()
if exp != got {
// Split each string into lines and compare the lines.