forked from steger/pr3-ws202627
Ja das ist doch wunderbar
parent
e3a517a931
commit
eaa0a8b7de
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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"
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -14,6 +14,11 @@ func plus(a int, b int) int {
|
||||||
// return a + b
|
// 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.
|
// 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 {
|
func plusPlus(a, b, c int) int {
|
||||||
return a + b + c
|
return a + b + c
|
||||||
|
|
@ -26,6 +31,10 @@ func plusNamed(a, b int) (result int) {
|
||||||
return
|
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.
|
// 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) {
|
func plusDescription(a int, b int) (int, string) {
|
||||||
result := a + b
|
result := a + b
|
||||||
|
|
@ -36,6 +45,7 @@ func main() {
|
||||||
|
|
||||||
res := plus(1, 2)
|
res := plus(1, 2)
|
||||||
fmt.Println("1+2 =", res)
|
fmt.Println("1+2 =", res)
|
||||||
|
fmt.Println(plus(30, 18))
|
||||||
|
|
||||||
res = plusPlus(1, 2, 3)
|
res = plusPlus(1, 2, 3)
|
||||||
fmt.Println("1+2+3 =", res)
|
fmt.Println("1+2+3 =", res)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue