This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <cstring> | |
#include <cmath> | |
#include <utility> | |
#include <bitset> | |
#define fi first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <cstring> | |
#include <cmath> | |
#include <utility> | |
#include <bitset> | |
#include <stack> | |
#include <queue> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <iostream> | |
#include <vector> | |
#include <map> | |
#include <algorithm> | |
#include <cmath> | |
#include <string> | |
#include <cstring> | |
#include <queue> | |
#include <stack> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <iostream> | |
#include <vector> | |
#include <map> | |
#include <algorithm> | |
#include <cmath> | |
#include <string> | |
#include <cstring> | |
#include <queue> | |
#include <stack> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <iostream> | |
#include <cstring> | |
#include <vector> | |
#include <cstdlib> | |
#include <algorithm> | |
#include <map> | |
#include <utility> | |
#include <cctype> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Blog is the main business process(es). | |
type Blog interface { | |
// CreateArticle creates an article then publish it. | |
CreateArticle(article Article) error | |
// GetArticles retrieves an article based on its id. | |
GetArticle(id int) (Article, error) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package blog | |
import "time" | |
// Article is our beloved article struct. | |
// This struct can be moved to another package, | |
// such as `package entity`. | |
// But, I choose to put it here because | |
// of readability reason. | |
type Article struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Kubernetes struct { | |
// omitted | |
} | |
type Service struct { | |
Name string | |
HasMetric bool | |
HasLog bool | |
HasDocument bool | |
HasCICD bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
ctx := context.Background() | |
kube := &Kubernetes{} | |
checker := &Checker{} | |
services, _ := kube.AllServices(ctx) | |
// let's make a new services container | |
// so we don't bother with pointer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (c *Checker) CheckStandardsGoroutineChannel(ctx context.Context, svc *Service, svcChan chan *Service, errChan chan []error) { | |
// this function still does what CheckStandards does, | |
// but instead of returning the values, | |
// it sends the values to channel | |
svcChan <- svc | |
errChan <- errorList | |
} | |
func main() { | |
ctx := context.Background() |
OlderNewer