From 314baff9ba7447078d9a522acf5d4e93a730e15b Mon Sep 17 00:00:00 2001
From: Felix Delattre <fd@gfz-potsdam.de>
Date: Wed, 17 Feb 2021 10:33:08 +0000
Subject: [PATCH] Provided basic go project structure

---
 .gitignore     |  9 +++++++++
 .gitlab-ci.yml | 29 +++++++++++++++++++++++++++++
 README.rst     |  2 +-
 go.mod         |  3 +++
 main.go        | 32 ++++++++++++++++++++++++++++++++
 main_test.go   | 32 ++++++++++++++++++++++++++++++++
 6 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 .gitignore
 create mode 100644 .gitlab-ci.yml
 create mode 100644 go.mod
 create mode 100644 main.go
 create mode 100644 main_test.go

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0a74695
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+config.toml
+main
+rcli
+
+# Test binary, build with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..f28cf40
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,29 @@
+image: golang:latest
+
+variables:
+  REPO_NAME: git.gfz-potsdam.de/dynamicexposure/rabotnik/rcli
+
+before_script:
+  - go version
+  - mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
+  - ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
+  - cd $GOPATH/src/$REPO_NAME
+
+stages:
+  - test
+  - build
+
+format:
+  stage: test
+  script:
+    - go fmt $(go list ./... | grep -v /vendor/)
+    - go vet $(go list ./... | grep -v /vendor/)
+    - go test -race $(go list ./... | grep -v /vendor/)
+
+compile:
+  stage: build
+  script:
+    - go build -race -ldflags "-extldflags '-static'" -o $CI_PROJECT_DIR/rcli
+  artifacts:
+    paths:
+      - rcli
diff --git a/README.rst b/README.rst
index e5058c7..03dd7a6 100644
--- a/README.rst
+++ b/README.rst
@@ -5,7 +5,7 @@ rabotnik command line interface
 Copyright and copyleft
 ----------------------
 
-Copyright (c) 2021
+Copyright (C) 2021
 
 * Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ
 
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..ea2b501
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,3 @@
+module git.gfz-potsdam.de/dynamicexposure/rabotnik/rcli
+
+go 1.15
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..8e6eb09
--- /dev/null
+++ b/main.go
@@ -0,0 +1,32 @@
+/*
+ * rabotnik command line interface
+ *
+ * Copyright (C) 2021:
+ *   Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ */
+
+package main
+
+import (
+	"log"
+)
+
+/*
+* Main function
+ */
+func main() {
+	log.Println("Hello world")
+}
diff --git a/main_test.go b/main_test.go
new file mode 100644
index 0000000..d4920aa
--- /dev/null
+++ b/main_test.go
@@ -0,0 +1,32 @@
+/*
+ * rabotnik command line interface
+ *
+ * Copyright (C) 2021:
+ *   Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ */
+
+package main
+
+import (
+	"testing"
+)
+
+func TestMain(t *testing.T) {
+	err := error(nil)
+	if err != nil {
+		t.Fatal(err)
+	}
+}
-- 
GitLab