This file contains hidden or 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
"NewService": { | |
"scope": "go", | |
"prefix": "NewService", | |
"body": [ | |
"// Configuration is a alias for a function that takes a Service pointer and modifies it", | |
"type Configuration func(s *Service) error", | |
"", | |
"// Service is a struct that holds all repositories and combines logic", | |
"type Service struct {", |
This file contains hidden or 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
{ | |
"ErrCheck": { | |
// scope is a comma seperated list of languages to apply ErrCheck snippet to | |
"scope": "go", | |
// Prefix is the name of the snippet | |
"prefix": "ErrCheck", | |
// Body is the lines of code to insert | |
"body": [ | |
"if err != nil {", | |
" return err", |
This file contains hidden or 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
// exprInternal contains the core of type checking of expressions. | |
// Must only be called by rawExpr. | |
// | |
func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind { | |
// make sure x has a valid state in case of bailout | |
// (was issue 5770) | |
x.mode = invalid | |
x.typ = Typ[Invalid] | |
switch e := e.(type) { |
This file contains hidden or 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 main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println("Hello, Reader! Your learning about 'goto' statement") | |
// We create a for loop which runs until i is 10 | |
for i := 0; i < 10; i++ { |
This file contains hidden or 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 (s *Scanner) scanComment() string { | |
// initial '/' already consumed; s.ch == '/' || s.ch == '*' | |
offs := s.offset - 1 // position of initial '/' | |
next := -1 // position immediately following the comment; < 0 means invalid comment | |
numCR := 0 | |
if s.ch == '/' { | |
//-style comment | |
// (the final '\n' is not considered part of the comment) | |
s.next() |
This file contains hidden or 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 main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println("Hello, Reader! Your learning about 'goto' statement") | |
// We create a for loop which runs until i is 10 |
This file contains hidden or 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 main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println("Hello, Reader! Your learning about 'goto' statement") | |
// We create a for loop which runs until i is 10 | |
for i := 0; i < 10; i++ { |
This file contains hidden or 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 main | |
import ( | |
"fmt" | |
"net/http" | |
"log" | |
) | |
func main() { | |
http.HandleFunc("/hello", HelloReader) |
This file contains hidden or 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
2021/08/11 08:52:49 The response was of type: block_actions | |
2021/08/11 08:52:49 &{ActionID:answer BlockID:n3t Type:checkboxes Text:{Type: Text: Emoji:false Verbatim:false} Value: ActionTs:1628664769.502596 SelectedOption:{Text:<nil> Value: Description:<nil> URL:} SelectedOptions:[{Text:0xc0003b2f00 Value:yes Description:0xc0003b2f30 URL:}] SelectedUser: SelectedUsers:[] SelectedChannel: SelectedChannels:[] SelectedConversation: SelectedConversations:[] SelectedDate: SelectedTime: InitialOption:{Text:<nil> Value: Description:<nil> URL:} InitialUser: InitialChannel: InitialConversation: InitialDate: InitialTime:} | |
2021/08/11 08:52:49 Selected option: [{0xc0003b2f00 yes 0xc0003b2f30 }] |
This file contains hidden or 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 handleInteractionEvent(interaction slack.InteractionCallback, client *slack.Client) error { | |
// This is where we would handle the interaction | |
// Switch depending on the Type | |
log.Printf("The action called is: %s\n", interaction.ActionID) | |
log.Printf("The response was of type: %s\n", interaction.Type) | |
switch interaction.Type { | |
case slack.InteractionTypeBlockActions: | |
// This is a block action, so we need to handle it | |
for _, action := range interaction.ActionCallback.BlockActions { |