From eaa0a8b7de18b56282c9cc6c9fb813b5db7cb9e1 Mon Sep 17 00:00:00 2001 From: ChaosLL1337 Date: Wed, 21 Oct 2026 06:19:47 +0000 Subject: [PATCH] Ja das ist doch wunderbar --- .devcontainer/devcontainer-lock.json | 9 +++++++++ .devcontainer/devcontainer.json | 26 ++++++++++++++++++++++++++ .github/dependabot.yml | 12 ++++++++++++ go/01-basics/11-functions.go | 10 ++++++++++ go/02-next-level/02-methoden.go | 23 +++++++++++++++++++++++ 5 files changed, 80 insertions(+) create mode 100644 .devcontainer/devcontainer-lock.json create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/dependabot.yml create mode 100644 go/02-next-level/02-methoden.go diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json new file mode 100644 index 0000000..5c99099 --- /dev/null +++ b/.devcontainer/devcontainer-lock.json @@ -0,0 +1,9 @@ +{ + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "version": "2.17.0", + "resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:25b9f05705ffba7dbe503230ac76081419306f8c8bc88e0ce78c4ecd99a0c78c", + "integrity": "sha256:25b9f05705ffba7dbe503230ac76081419306f8c8bc88e0ce78c4ecd99a0c78c" + } + } +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..9b5f060 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-in-docker +{ + "name": "Docker in Docker", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:bookworm", + + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "version": "latest", + "moby": "true" + } + } + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "docker --version", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f33a02c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/go/01-basics/11-functions.go b/go/01-basics/11-functions.go index cc3c6af..3794a5e 100644 --- a/go/01-basics/11-functions.go +++ b/go/01-basics/11-functions.go @@ -14,6 +14,11 @@ func plus(a int, b int) int { // return a + b // } +func plus2(a int, b int) (result int) { + result = a + b + return +} + // A function with multiple parameters of the same type can be shortened by listing the type only once. func plusPlus(a, b, c int) int { return a + b + c @@ -26,6 +31,10 @@ func plusNamed(a, b int) (result int) { return } +func nonplusultra(a int, b int) (result int, description string) { + return a + b, fmt.Sprintf("the sum of %d and %d is %d, a, b, a+b") +} + // A function can return multiple values. Here we return the sum and a formatted string description of the operation. func plusDescription(a int, b int) (int, string) { result := a + b @@ -36,6 +45,7 @@ func main() { res := plus(1, 2) fmt.Println("1+2 =", res) + fmt.Println(plus(30, 18)) res = plusPlus(1, 2, 3) fmt.Println("1+2+3 =", res) diff --git a/go/02-next-level/02-methoden.go b/go/02-next-level/02-methoden.go new file mode 100644 index 0000000..4b94b3e --- /dev/null +++ b/go/02-next-level/02-methoden.go @@ -0,0 +1,23 @@ +package main + +import "fmt" + +type Counter struct { + value int +} + +func (c Counter /** value reciever **/) toString() string { + return fmt.Sprintf("Counter Value: %d", c.value) +} + +func (c *Counter /**Pointer reciever**/) Increment() { + fmt.Printf("Inside Increment: %p\n", c) + c.value = c.value + 1 +} + +func main() { + c := Counter{} + fmt.Println(c) + c.Increment() + fmt.Println(c) +}