iris-contrib / iris-contrib/middleware

get a error when I using "github.com/iris-contrib/middleware/cors"

Open
#60 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Go
Stars
239
Forks
89
PR merge metrics
No merged PRs in 30d

Description

go version go1.14.4 linux/amd64
programe:
package main

import (
"fmt"
"github.com/iris-contrib/middleware/cors"
"log"
"net"
"os"
)

func main() {
fmt.Println("Hello World!")
fmt.Println(os.Getuid())
f, err := os.Open("test.json")
if err != nil {
fmt.Printf("%s\n", err)
}
crs := cors.New(cors.Options{
AllowedOrigins: []string{"*"}, // allows everything, use that to change the hosts.
AllowCredentials: true,
})

}
error :
$ go build hello.go

github.com/iris-contrib/middleware/cors

gowork/src/github.com/iris-contrib/middleware/cors/cors.go:144:10: cannot use c.Serve (type func("github.com/kataras/iris/context".Context)) as type "github.com/kataras/iris/context".Handler in return argument

otherwise:
in go.mod:
there is a conflict between
github.com/iris-contrib/middleware v12.1.2+incompatible and import github.com/iris-contrib/middleware/cors

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported go build hello.go failure with Go 1.14.4, then inspect cors/cors.go around line 144 and the dependency versions in go.mod. Confirm whether the c.Serve and context.Handler mismatch is caused by incompatible Iris versions; done means the compatibility problem is resolved or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.