Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump github/codeql-action and fix issue #341 #378

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3
- name: Linting
uses: golangci/golangci-lint-action@v2.5.2
uses: golangci/golangci-lint-action@v3
with:
version: v1.29
- name: test
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -50,7 +50,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -64,4 +64,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
33 changes: 33 additions & 0 deletions item.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,39 @@ func send(ctx context.Context, ch chan<- Item, items ...interface{}) {
}
}

func sendSingleItem(ctx context.Context, ch chan<- Item, strategy CloseChannelStrategy, items ...interface{}) {
if strategy == CloseChannel {
defer close(ch)
}
for _, currentItem := range items {
switch item := currentItem.(type) {
default:
rt := reflect.TypeOf(item)
switch rt.Kind() {
default:
Of(item).SendContext(ctx, ch)
case reflect.Chan:
in := reflect.ValueOf(currentItem)
for {
v, ok := in.Recv()
if !ok {
return
}
currentItem := v.Interface()
switch item := currentItem.(type) {
default:
Of(item).SendContext(ctx, ch)
case error:
Error(item).SendContext(ctx, ch)
}
}
}
case error:
Error(item).SendContext(ctx, ch)
}
}
}

// Error checks if an item is an error.
func (i Item) Error() bool {
return i.E != nil
Expand Down
2 changes: 1 addition & 1 deletion iterable_just.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ func (i *justIterable) Observe(opts ...Option) <-chan Item {
option := parseOptions(append(i.opts, opts...)...)
next := option.buildChannel()

go SendItems(option.buildContext(emptyContext), next, CloseChannel, i.items)
go sendSingleItem(option.buildContext(emptyContext), next, CloseChannel, i.items...)
return next
}
4 changes: 3 additions & 1 deletion single.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package rxgo

import "context"
import (
"context"
)

// Single is a observable with a single element.
type Single interface {
Expand Down