Skip to content

Instantly share code, notes, and snippets.

🌎
Working on @micro

Asim Aslam asim

🌎
Working on @micro
Block or report user

Report or block asim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View client.go
package main
import (
"fmt"
"github.com/micro/clients/go/client"
)
type Request struct {
Count string `json:"count"`
View gist:3c420257ee499d9e2b1f64b0fef4d201
{
"ref": "refs/heads/master",
"before": "07b8534f3fa3d97dc18af7aaea89a50c8835ff27",
"after": "21291f4906f78dff2c19d5df8a071109f163673f",
"repository": {
"id": 191024669,
"node_id": "MDEwOlJlcG9zaXRvcnkxOTEwMjQ2Njk=",
"name": "services",
"full_name": "micro/services",
"private": false,
View gist:a7938c42462f2c10079c002af64abdec
{
"ref": "refs/heads/master",
"before": "07b8534f3fa3d97dc18af7aaea89a50c8835ff27",
"after": "21291f4906f78dff2c19d5df8a071109f163673f",
"repository": {
"id": 191024669,
"node_id": "MDEwOlJlcG9zaXRvcnkxOTEwMjQ2Njk=",
"name": "services",
"full_name": "micro/services",
"private": false,
View broker.md
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 Feb 11, 2020
The new service page
View new.md

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 Feb 7, 2020
The new service page
View new.md

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 Feb 8, 2020
A go-micro service
View helloworld.go
package main
import (
"context"
"log"
pb "github.com/micro/examples/helloworld/proto"
"github.com/micro/go-micro/v2"
)
View auth.go
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
View protoc.sh
#!/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
View leak.go
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)
You can’t perform that action at this time.