[lxc-devel] [go-lxc/v2] move examples into individual folders
caglar10ur on Github
lxc-bot at linuxcontainers.org
Wed Dec 26 22:09:29 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 303 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20181226/8278af25/attachment.bin>
-------------- next part --------------
From 79ed1bd2e47281c9a4689722de2058858184f4e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= <caglar at 10ur.org>
Date: Wed, 26 Dec 2018 13:59:19 -0800
Subject: [PATCH] move examples into individual folders
---
.gitignore | 35 ++-----------------
examples/Makefile | 20 +++++------
examples/{ => attach}/attach.go | 0
.../attach_with_pipes.go | 0
examples/{ => checkpoint}/checkpoint.go | 0
examples/{ => clone}/clone.go | 0
.../concurrent_create.go | 0
.../concurrent_destroy.go | 0
.../concurrent_shutdown.go | 0
.../concurrent_start.go | 0
.../{ => concurrent_stop}/concurrent_stop.go | 0
.../concurrent_stress.go | 0
examples/{ => config}/config.go | 0
examples/{ => console}/console.go | 0
examples/{ => create}/create.go | 0
.../{ => create_snapshot}/create_snapshot.go | 0
examples/{ => destroy}/destroy.go | 0
.../destroy_snapshots.go | 0
.../device_add_remove.go | 0
examples/{ => execute}/execute.go | 0
examples/{ => freeze}/freeze.go | 0
examples/{ => interfaces}/interfaces.go | 0
examples/{ => ipaddress}/ipaddress.go | 0
examples/{ => limit}/limit.go | 0
examples/{ => list}/list.go | 0
examples/{ => list_keys}/list_keys.go | 0
.../{ => list_snapshots}/list_snapshots.go | 0
examples/{ => reboot}/reboot.go | 0
examples/{ => rename}/rename.go | 0
.../restore_snapshot.go | 0
examples/{ => shutdown}/shutdown.go | 0
examples/{ => start}/start.go | 0
examples/{ => stats}/stats.go | 0
examples/{ => stop}/stop.go | 0
examples/{ => unfreeze}/unfreeze.go | 0
35 files changed, 12 insertions(+), 43 deletions(-)
rename examples/{ => attach}/attach.go (100%)
rename examples/{ => attach_with_pipes}/attach_with_pipes.go (100%)
rename examples/{ => checkpoint}/checkpoint.go (100%)
rename examples/{ => clone}/clone.go (100%)
rename examples/{ => concurrent_create}/concurrent_create.go (100%)
rename examples/{ => concurrent_destroy}/concurrent_destroy.go (100%)
rename examples/{ => concurrent_shutdown}/concurrent_shutdown.go (100%)
rename examples/{ => concurrent_start}/concurrent_start.go (100%)
rename examples/{ => concurrent_stop}/concurrent_stop.go (100%)
rename examples/{ => concurrent_stress}/concurrent_stress.go (100%)
rename examples/{ => config}/config.go (100%)
rename examples/{ => console}/console.go (100%)
rename examples/{ => create}/create.go (100%)
rename examples/{ => create_snapshot}/create_snapshot.go (100%)
rename examples/{ => destroy}/destroy.go (100%)
rename examples/{ => destroy_snapshots}/destroy_snapshots.go (100%)
rename examples/{ => device_add_remove}/device_add_remove.go (100%)
rename examples/{ => execute}/execute.go (100%)
rename examples/{ => freeze}/freeze.go (100%)
rename examples/{ => interfaces}/interfaces.go (100%)
rename examples/{ => ipaddress}/ipaddress.go (100%)
rename examples/{ => limit}/limit.go (100%)
rename examples/{ => list}/list.go (100%)
rename examples/{ => list_keys}/list_keys.go (100%)
rename examples/{ => list_snapshots}/list_snapshots.go (100%)
rename examples/{ => reboot}/reboot.go (100%)
rename examples/{ => rename}/rename.go (100%)
rename examples/{ => restore_snapshot}/restore_snapshot.go (100%)
rename examples/{ => shutdown}/shutdown.go (100%)
rename examples/{ => start}/start.go (100%)
rename examples/{ => stats}/stats.go (100%)
rename examples/{ => stop}/stop.go (100%)
rename examples/{ => unfreeze}/unfreeze.go (100%)
diff --git a/.gitignore b/.gitignore
index f1980a2..352fdba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,36 +1,5 @@
-examples/attach
-examples/attach_with_pipes
-examples/checkpoint
-examples/clone
-examples/concurrent_create
-examples/concurrent_destroy
-examples/concurrent_shutdown
-examples/concurrent_start
-examples/concurrent_stop
-examples/concurrent_stress
-examples/config
-examples/console
-examples/create
-examples/create_snapshot
-examples/destroy
-examples/destroy_snapshots
-examples/device_add_remove
-examples/execute
-examples/freeze
-examples/interfaces
-examples/ipaddress
-examples/limit
-examples/list
-examples/list_keys
-examples/list_snapshots
-examples/reboot
-examples/rename
-examples/restore_snapshot
-examples/shutdown
-examples/start
-examples/stats
-examples/stop
-examples/unfreeze
+examples/*/*
+!examples/*/*.go
coverage.out
tags
*.swp
diff --git a/examples/Makefile b/examples/Makefile
index effce0c..8f501e1 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -1,33 +1,33 @@
NO_COLOR=\033[0m
OK_COLOR=\033[0;32m
-ALL_GO_FILES = $(wildcard *.go)
-ALL_FILES = $(patsubst %.go,%,$(ALL_GO_FILES))
+ALL_GO_FILES = $(wildcard */*.go)
+ALL_BIN_FILES = $(patsubst %.go,%,$(ALL_GO_FILES))
-all: $(ALL_FILES)
+all: $(ALL_GO_FILES)
define PROGRAM_template
$(1): format vet lint
@echo "$(OK_COLOR)==> Building $(1) $(NO_COLOR)"
- @go build $(1).go
+ @cd $(dir $1); go build
endef
-$(foreach prog,$(ALL_FILES),$(eval $(call PROGRAM_template,$(prog))))
+$(foreach prog,$(ALL_GO_FILES),$(eval $(call PROGRAM_template,$(prog))))
clean:
- @$(foreach file,$(ALL_FILES),rm -f $(file);)
+ @$(foreach file,$(ALL_BIN_FILES),rm -f $(file);)
format:
@echo "$(OK_COLOR)==> Formatting the code $(NO_COLOR)"
- @gofmt -s -w *.go
- @goimports -w *.go
+ @$(foreach file,$(ALL_GO_FILES),gofmt -s -w $(file);)
+ @$(foreach file,$(ALL_GO_FILES),goimports -w $(file);)
vet:
@echo "$(OK_COLOR)==> Running go vet $(NO_COLOR)"
- @`which go` vet .
+ @$(foreach file,$(ALL_GO_FILES),go vet $(file);)
lint:
@echo "$(OK_COLOR)==> Running golint $(NO_COLOR)"
- @`which golint` .
+ @$(foreach file,$(ALL_GO_FILES),golint $(file);)
.PHONY: all clean format vet lint
diff --git a/examples/attach.go b/examples/attach/attach.go
similarity index 100%
rename from examples/attach.go
rename to examples/attach/attach.go
diff --git a/examples/attach_with_pipes.go b/examples/attach_with_pipes/attach_with_pipes.go
similarity index 100%
rename from examples/attach_with_pipes.go
rename to examples/attach_with_pipes/attach_with_pipes.go
diff --git a/examples/checkpoint.go b/examples/checkpoint/checkpoint.go
similarity index 100%
rename from examples/checkpoint.go
rename to examples/checkpoint/checkpoint.go
diff --git a/examples/clone.go b/examples/clone/clone.go
similarity index 100%
rename from examples/clone.go
rename to examples/clone/clone.go
diff --git a/examples/concurrent_create.go b/examples/concurrent_create/concurrent_create.go
similarity index 100%
rename from examples/concurrent_create.go
rename to examples/concurrent_create/concurrent_create.go
diff --git a/examples/concurrent_destroy.go b/examples/concurrent_destroy/concurrent_destroy.go
similarity index 100%
rename from examples/concurrent_destroy.go
rename to examples/concurrent_destroy/concurrent_destroy.go
diff --git a/examples/concurrent_shutdown.go b/examples/concurrent_shutdown/concurrent_shutdown.go
similarity index 100%
rename from examples/concurrent_shutdown.go
rename to examples/concurrent_shutdown/concurrent_shutdown.go
diff --git a/examples/concurrent_start.go b/examples/concurrent_start/concurrent_start.go
similarity index 100%
rename from examples/concurrent_start.go
rename to examples/concurrent_start/concurrent_start.go
diff --git a/examples/concurrent_stop.go b/examples/concurrent_stop/concurrent_stop.go
similarity index 100%
rename from examples/concurrent_stop.go
rename to examples/concurrent_stop/concurrent_stop.go
diff --git a/examples/concurrent_stress.go b/examples/concurrent_stress/concurrent_stress.go
similarity index 100%
rename from examples/concurrent_stress.go
rename to examples/concurrent_stress/concurrent_stress.go
diff --git a/examples/config.go b/examples/config/config.go
similarity index 100%
rename from examples/config.go
rename to examples/config/config.go
diff --git a/examples/console.go b/examples/console/console.go
similarity index 100%
rename from examples/console.go
rename to examples/console/console.go
diff --git a/examples/create.go b/examples/create/create.go
similarity index 100%
rename from examples/create.go
rename to examples/create/create.go
diff --git a/examples/create_snapshot.go b/examples/create_snapshot/create_snapshot.go
similarity index 100%
rename from examples/create_snapshot.go
rename to examples/create_snapshot/create_snapshot.go
diff --git a/examples/destroy.go b/examples/destroy/destroy.go
similarity index 100%
rename from examples/destroy.go
rename to examples/destroy/destroy.go
diff --git a/examples/destroy_snapshots.go b/examples/destroy_snapshots/destroy_snapshots.go
similarity index 100%
rename from examples/destroy_snapshots.go
rename to examples/destroy_snapshots/destroy_snapshots.go
diff --git a/examples/device_add_remove.go b/examples/device_add_remove/device_add_remove.go
similarity index 100%
rename from examples/device_add_remove.go
rename to examples/device_add_remove/device_add_remove.go
diff --git a/examples/execute.go b/examples/execute/execute.go
similarity index 100%
rename from examples/execute.go
rename to examples/execute/execute.go
diff --git a/examples/freeze.go b/examples/freeze/freeze.go
similarity index 100%
rename from examples/freeze.go
rename to examples/freeze/freeze.go
diff --git a/examples/interfaces.go b/examples/interfaces/interfaces.go
similarity index 100%
rename from examples/interfaces.go
rename to examples/interfaces/interfaces.go
diff --git a/examples/ipaddress.go b/examples/ipaddress/ipaddress.go
similarity index 100%
rename from examples/ipaddress.go
rename to examples/ipaddress/ipaddress.go
diff --git a/examples/limit.go b/examples/limit/limit.go
similarity index 100%
rename from examples/limit.go
rename to examples/limit/limit.go
diff --git a/examples/list.go b/examples/list/list.go
similarity index 100%
rename from examples/list.go
rename to examples/list/list.go
diff --git a/examples/list_keys.go b/examples/list_keys/list_keys.go
similarity index 100%
rename from examples/list_keys.go
rename to examples/list_keys/list_keys.go
diff --git a/examples/list_snapshots.go b/examples/list_snapshots/list_snapshots.go
similarity index 100%
rename from examples/list_snapshots.go
rename to examples/list_snapshots/list_snapshots.go
diff --git a/examples/reboot.go b/examples/reboot/reboot.go
similarity index 100%
rename from examples/reboot.go
rename to examples/reboot/reboot.go
diff --git a/examples/rename.go b/examples/rename/rename.go
similarity index 100%
rename from examples/rename.go
rename to examples/rename/rename.go
diff --git a/examples/restore_snapshot.go b/examples/restore_snapshot/restore_snapshot.go
similarity index 100%
rename from examples/restore_snapshot.go
rename to examples/restore_snapshot/restore_snapshot.go
diff --git a/examples/shutdown.go b/examples/shutdown/shutdown.go
similarity index 100%
rename from examples/shutdown.go
rename to examples/shutdown/shutdown.go
diff --git a/examples/start.go b/examples/start/start.go
similarity index 100%
rename from examples/start.go
rename to examples/start/start.go
diff --git a/examples/stats.go b/examples/stats/stats.go
similarity index 100%
rename from examples/stats.go
rename to examples/stats/stats.go
diff --git a/examples/stop.go b/examples/stop/stop.go
similarity index 100%
rename from examples/stop.go
rename to examples/stop/stop.go
diff --git a/examples/unfreeze.go b/examples/unfreeze/unfreeze.go
similarity index 100%
rename from examples/unfreeze.go
rename to examples/unfreeze/unfreeze.go
More information about the lxc-devel
mailing list