From b5a940e7395a92c8f457a83591f8ee67af9672d4 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 4 Jun 2015 12:02:49 -0700 Subject: [PATCH] Implement custom date command for cross platform portability --- Makefile | 2 +- buildscripts/date.go | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 buildscripts/date.go diff --git a/Makefile b/Makefile index 958e20af..5c00e528 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ env: install: test-all @echo "Installing mc:" - @godep go install -a -ldflags "-X main.BuildDate `date -u '+%FT%T.%N%:z'`" github.com/minio/mc + @godep go install -a -ldflags "-X main.BuildDate `go run buildscripts/date.go`" github.com/minio/mc @mkdir -p $(HOME)/.mc clean: diff --git a/buildscripts/date.go b/buildscripts/date.go new file mode 100644 index 00000000..d10a5d19 --- /dev/null +++ b/buildscripts/date.go @@ -0,0 +1,26 @@ +/* + * Minio Client (C) 2014, 2015 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package main + +import ( + "fmt" + "time" +) + +func main() { + fmt.Println(time.Now().UTC().Format(time.RFC3339Nano)) +}