初始化捏
This commit is contained in:
14
bluePrint.go
Normal file
14
bluePrint.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package lab
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zire"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Application struct{}
|
||||||
|
|
||||||
|
func (a *Application) start() {}
|
||||||
|
|
||||||
|
func test() {
|
||||||
|
app := zire.Karmaforge[Application]()
|
||||||
|
app.start()
|
||||||
|
}
|
||||||
11
go.mod
Normal file
11
go.mod
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
module example
|
||||||
|
|
||||||
|
go 1.25
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/zire v0.0.0
|
||||||
|
)
|
||||||
|
replace (
|
||||||
|
github.com/zire v0.0.0 => /home/nobara/projects/zire
|
||||||
|
)
|
||||||
|
|
||||||
5
interface.go
Normal file
5
interface.go
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package lab
|
||||||
|
|
||||||
|
type Animal interface {
|
||||||
|
sound() string
|
||||||
|
}
|
||||||
21
pasture/dog.go
Normal file
21
pasture/dog.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package pasture
|
||||||
|
|
||||||
|
type Dog struct {
|
||||||
|
lines string
|
||||||
|
weapon string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Dog) Sound() string {
|
||||||
|
return d.lines
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Dog) Dangers() bool {
|
||||||
|
if len(d.weapon) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDog(line string) *Dog {
|
||||||
|
return &Dog{lines: line}
|
||||||
|
}
|
||||||
13
pasture/sheep.go
Normal file
13
pasture/sheep.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package pasture
|
||||||
|
|
||||||
|
type Sheep struct {
|
||||||
|
lines string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Sheep) Sound() string {
|
||||||
|
return s.lines
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSheep(line string) *Sheep {
|
||||||
|
return &Sheep{lines: line}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user