Skip to content

Commit

Permalink
feat: 新增树状模版任务引擎模式
Browse files Browse the repository at this point in the history
  • Loading branch information
googs1025 committed Jan 6, 2024
1 parent f87a28a commit 361258a
Show file tree
Hide file tree
Showing 39 changed files with 278 additions and 49 deletions.
4 changes: 3 additions & 1 deletion README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@

22. event模式 [代码示例](https://github.com/StudyPlace-io/Golang-Concurrency-Pattern-Demo/tree/main/event-mode)

23. worker-job模式 [代码示例](https://github.com/StudyPlace-io/Golang-Concurrency-Pattern-Demo/tree/main/worker-job-mode)
23. worker-job模式 [代码示例](https://github.com/StudyPlace-io/Golang-Concurrency-Pattern-Demo/tree/main/worker-job-mode)

24. tree-template-engine模式 [代码示例](https://github.com/StudyPlace-io/Golang-Concurrency-Pattern-Demo/tree/main/tree-template-engine)
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ Concurrency modes that I usually learn (the mode classification is mainly based

22. event mode [code example](https://github.com/StudyPlace-io/Golang-Concurrency-Pattern-Demo/tree/main/event-mode)

23. worker-job mode [code example](https://github.com/StudyPlace-io/Golang-Concurrency-Pattern-Demo/tree/main/worker-job-mode)
23. worker-job mode [code example](https://github.com/StudyPlace-io/Golang-Concurrency-Pattern-Demo/tree/main/worker-job-mode)

24. tree-template-engine mode [code example](https://github.com/StudyPlace-io/Golang-Concurrency-Pattern-Demo/tree/main/tree-template-engine)
2 changes: 1 addition & 1 deletion event-mode/broadcaster/broadcaseter.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package broadcaster

import (
"github.com/practice/Golang-Concurrency-Pattern-Demo/event-mode/event"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/event-mode/event"
"sync"
)

Expand Down
2 changes: 1 addition & 1 deletion event-mode/broadcaster/watcher.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package broadcaster

import (
"github.com/practice/Golang-Concurrency-Pattern-Demo/event-mode/event"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/event-mode/event"
)

// Interface 接口 watcher 实现
Expand Down
4 changes: 2 additions & 2 deletions event-mode/event_broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package event_broadcaster

import (
"fmt"
"github.com/practice/Golang-Concurrency-Pattern-Demo/event-mode/broadcaster"
"github.com/practice/Golang-Concurrency-Pattern-Demo/event-mode/event"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/event-mode/broadcaster"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/event-mode/event"
"time"
)

Expand Down
2 changes: 1 addition & 1 deletion event-mode/event_broadcaster_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package event_broadcaster

import (
"github.com/practice/Golang-Concurrency-Pattern-Demo/event-mode/event"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/event-mode/event"
"testing"
"time"
)
Expand Down
2 changes: 1 addition & 1 deletion exit-gracefully-mode/exit_gracefully1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"flag"
"fmt"
"github.com/practice/Golang-Concurrency-Pattern-Demo/exit-gracefully-mode/signals"
"github.com/spf13/pflag"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/exit-gracefully-mode/signals"
"k8s.io/klog/v2"
"log"
"net/http"
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/practice/Golang-Concurrency-Pattern-Demo
module github.com/study-io/Golang-Concurrency-Pattern-Demo

go 1.18

require (
github.com/antlabs/timer v0.0.10
github.com/ghodss/yaml v1.0.0
github.com/google/uuid v1.3.0
github.com/robfig/cron/v3 v3.0.1
github.com/sirupsen/logrus v1.8.1
github.com/smartystreets/goconvey v1.8.0
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 1 addition & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down Expand Up @@ -356,8 +357,6 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.13.1 h1:Ef7KhSmjZcK6AVf9YbJdvPYG9avaF0ZxudX+ThRdWfU=
github.com/smartystreets/assertions v1.13.1/go.mod h1:cXr/IwVfSo/RbCSPhoAPv73p3hlSdrBH/b3SdnW/LMY=
Expand Down Expand Up @@ -560,7 +559,6 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
4 changes: 2 additions & 2 deletions kube-controller-manager-mode/app/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package app
import (
"context"
"fmt"
"github.com/practice/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/app/config"
"github.com/practice/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/app/options"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/app/config"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/app/options"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/component-base/version/verflag"
"k8s.io/klog/v2"
Expand Down
4 changes: 2 additions & 2 deletions kube-controller-manager-mode/app/my_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package app
import (
"context"
"fmt"
"github.com/practice/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/pkg/controller/mycontroller1"
"github.com/practice/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/pkg/controller/mycontroller2"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/pkg/controller/mycontroller1"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/pkg/controller/mycontroller2"
"k8s.io/klog/v2"
)

Expand Down
2 changes: 1 addition & 1 deletion kube-controller-manager-mode/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package options
import (
"flag"
"fmt"
"github.com/practice/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/app/config"
"github.com/spf13/pflag"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/app/config"
"k8s.io/klog/v2"
"os"
"strings"
Expand Down
2 changes: 1 addition & 1 deletion kube-controller-manager-mode/controller-manager.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/practice/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/app"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kube-controller-manager-mode/app"
"k8s.io/component-base/cli"
_ "k8s.io/component-base/logs/json/register" // for JSON log format registration
_ "k8s.io/component-base/metrics/prometheus/restclient"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mycontroller1
import (
"context"
"fmt"
"github.com/practice/Golang-Concurrency-Pattern-Demo/gorountine-other-mode/group"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/gorountine-other-mode/group"
)

// Controller 控制器
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mycontroller2
import (
"context"
"fmt"
"github.com/practice/Golang-Concurrency-Pattern-Demo/gorountine-other-mode/group"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/gorountine-other-mode/group"
)

// Controller 控制器
Expand Down
2 changes: 1 addition & 1 deletion kube-controller-mode/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package kube_controller_mode

import (
"fmt"
"github.com/practice/Golang-Concurrency-Pattern-Demo/gorountine-other-mode/group"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/gorountine-other-mode/group"
)

// Controller 控制器
Expand Down
2 changes: 1 addition & 1 deletion kubelet-podworker-mode/kubelet.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/practice/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/app"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/app"
"k8s.io/component-base/cli"
"os"
)
Expand Down
2 changes: 1 addition & 1 deletion kubelet-podworker-mode/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package kubelet

import (
"context"
"github.com/practice/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/kubelet/config"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/kubelet/config"
"k8s.io/klog/v2"
"time"
)
Expand Down
4 changes: 2 additions & 2 deletions kubelet-podworker-mode/kubelet/kubelet_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package kubelet

import (
"github.com/practice/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/kubelet/config"
"github.com/practice/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/kubelet/container"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/kubelet/config"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/kubelet/container"
"testing"
"time"
)
Expand Down
2 changes: 1 addition & 1 deletion kubelet-podworker-mode/kubelet/pod.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package kubelet

import (
"github.com/practice/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/kubelet/container"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/kubelet/container"
)

// Pod 模拟Pod对象
Expand Down
2 changes: 1 addition & 1 deletion kubelet-podworker-mode/kubelet/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package kubelet
import (
"context"
"errors"
container2 "github.com/practice/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/kubelet/container"
container2 "github.com/study-io/Golang-Concurrency-Pattern-Demo/kubelet-podworker-mode/kubelet/container"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/klog/v2"
"sync"
Expand Down
4 changes: 2 additions & 2 deletions scheduler-mode/scheduler-with-plugins/demo/plugin.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package demo

import (
_interface "github.com/practice/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/interface"
"github.com/practice/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/nodes"
_interface "github.com/study-io/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/interface"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/nodes"
"math/rand"
)

Expand Down
2 changes: 1 addition & 1 deletion scheduler-mode/scheduler-with-plugins/demo/pod.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package demo

import (
_interface "github.com/practice/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/interface"
_interface "github.com/study-io/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/interface"
"k8s.io/klog/v2"
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package _interface

import "github.com/practice/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/nodes"
import "github.com/study-io/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/nodes"

// Pod 接口
type Pod interface {
Expand Down
2 changes: 1 addition & 1 deletion scheduler-mode/scheduler-with-plugins/queue.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package scheduler_with_plugins

import _interface "github.com/practice/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/interface"
import _interface "github.com/study-io/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/interface"

// Queue 调度队列
type Queue struct {
Expand Down
4 changes: 2 additions & 2 deletions scheduler-mode/scheduler-with-plugins/scheduler.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package scheduler_with_plugins

import (
_interface "github.com/practice/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/interface"
"github.com/practice/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/nodes"
_interface "github.com/study-io/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/interface"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/nodes"
"k8s.io/klog/v2"
"sync"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package scheduler_with_plugins

import (
"fmt"
"github.com/practice/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/demo"
_interface "github.com/practice/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/interface"
"github.com/practice/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/nodes"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/demo"
_interface "github.com/study-io/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/interface"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/scheduler-mode/scheduler-with-plugins/nodes"
"k8s.io/klog/v2"
"sync"
"testing"
Expand Down
2 changes: 1 addition & 1 deletion task-job-mode/common/constants/task.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package constants

import "github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
import "github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/model"

// 状态。目前task、job及plugin共用。
const (
Expand Down
4 changes: 2 additions & 2 deletions task-job-mode/plugins/demo/demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package demo

import (
"encoding/json"
"github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/common/constants"
"github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/common/constants"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"log"
"strconv"
"time"
Expand Down
4 changes: 2 additions & 2 deletions task-job-mode/plugins/interface.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package plugins

import (
"github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/plugins/demo"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/plugins/demo"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion task-job-mode/pool.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package task_job_mode

import (
"github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"log"
"sync"
)
Expand Down
2 changes: 1 addition & 1 deletion task-job-mode/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package task_job_mode

import (
"container/list"
"github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"sync"
)

Expand Down
6 changes: 3 additions & 3 deletions task-job-mode/worker.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package task_job_mode

import (
"github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/common/constants"
"github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/plugins"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/common/constants"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/plugins"
"log"
)

Expand Down
2 changes: 1 addition & 1 deletion task-job-mode/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package task_job_mode
import (
"encoding/json"
"github.com/google/uuid"
"github.com/practice/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
. "github.com/smartystreets/goconvey/convey"
"github.com/study-io/Golang-Concurrency-Pattern-Demo/task-job-mode/model"
"log"
"strconv"
"sync"
Expand Down
39 changes: 39 additions & 0 deletions tree-template-engine/manager.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package tree_template

import (
"github.com/study-io/Golang-Concurrency-Pattern-Demo/tree-template-engine/model"
"gopkg.in/yaml.v2"
"log"
"os"
)

type TreeTemplateEngine struct {
}

func NewTreeTemplateEngine() *TreeTemplateEngine {
return &TreeTemplateEngine{}
}

func (tte *TreeTemplateEngine) RunTask(task *model.Task) {
status := &model.Status{
Tasks: make(map[string]*model.Task),
}
runTask(task, status)
}

func (tte *TreeTemplateEngine) ParseYaml(path string) *model.Task {
// 读取YAML文件
data, err := os.ReadFile(path)
if err != nil {
log.Fatalf("Error reading YAML file: %v\n", err)
}

// 解析YAML文件

var taskTree model.Task
err = yaml.Unmarshal(data, &taskTree)
if err != nil {
log.Fatalf("Error parsing YAML: %v\n", err)
}
return &taskTree
}
Loading

0 comments on commit 361258a

Please sign in to comment.