Skip to content

Instantly share code, notes, and snippets.

package main

import (
        "context"
        "fmt"

        "github.com/micro/go-micro/v2"
        _ "github.com/micro/go-plugins/broker/grpc/v2"
)
@asim
asim / new.md
Last active February 11, 2020 15:33
The new service page

New Service

Create a new service

Service Name: fooba___________

Your service will be created in github.com/micro/services/fooba

Checkout and build

@asim
asim / new.md
Created February 7, 2020 15:43
The new service page

New Service

Create a new service

Service Name: fooba___________

Your service will be created in github.com/micro/services/fooba

Next steps

@asim
asim / helloworld.go
Last active February 8, 2020 22:14
A go-micro service
package main
import (
"context"
"log"
pb "github.com/micro/examples/helloworld/proto"
"github.com/micro/go-micro/v2"
)
@asim
asim / auth.go
Last active January 31, 2020 12:06
type Auth interface {
// Generate a new account
Generate(id string, ...GenerateOption) (*Account, error)
// Grant access to a resource
Grant(*Account, *Resource) error
// Revoke access to a resource
Revoke(*Account, *Resource) error
// Verify an account has access to a resource
Verify(*Account, *Resource) error
// Login to an account
#!/bin/bash
set -e
function trap_handler {
MYSELF="$0" # equals to my script name
LASTLINE="$1" # argument 1: last line of error occurence
LASTERR="$2" # argument 2: error code of last command
echo "Error: line ${LASTLINE} - exit status of last command: ${LASTERR}"
exit $2
goroutine 13023 [semacquire, 25 minutes]:
sync.runtime_SemacquireMutex(0xc0001bfcbc, 0x0, 0x0)
/usr/local/go/src/runtime/sema.go:71 +0x47
sync.(*RWMutex).RLock(...)
/usr/local/go/src/sync/rwmutex.go:50
github.com/micro/go-micro/router.(*table).Query(0xc0001bfcb0, 0xc00013a770, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
/go/pkg/mod/github.com/micro/go-micro@v1.18.1-0.20200115213837-6562154573a0/router/table.go:184 +0x57f
github.com/micro/go-micro/router.(*router).Lookup(0xc0000fc960, 0xc00013a770, 0x1, 0x1, 0x273be90, 0xc00094c270, 0xc001344fc8, 0xaca7b9, 0x1940e60)
/go/pkg/mod/github.com/micro/go-micro@v1.18.1-0.20200115213837-6562154573a0/router/default.go:840 +0x54
github.com/micro/micro/router/handler.(*Router).Lookup(0xc0002d0210, 0x1dd24c0, 0xc000f45900, 0xc000a72000, 0xc000f45ac0, 0xae7a0c, 0x1ab3cc0)
@asim
asim / README.md
Created November 11, 2019 09:38
Macro is for micro

Macro

Macro is for micro. Macro is a version of micro with ALL the plugins built in.

Overview

Many people seem to want a prebuilt version of micro with all the plugins. Or they just don't want to deal with the hassle of managing which plugins to add. Macro builds in all the plugins. Anything in go-plugins will be included in macro.

Micro License GoDoc Travis CI Go Report Card

Micro is a runtime for microservice development.

Overview

Micro addresses the key requirements for building scalable systems. It takes the microservice architecture pattern and transforms it into a set of tools which act as the building blocks of a platform. Micro deals with the complexity of distributed systems and provides simple abstractions already understood by developers.

@asim
asim / mdns.go
Created September 26, 2019 16:54
package main
import (
"fmt"
"time"
"github.com/micro/go-micro/registry"
)
func watch(r registry.Registry) {