Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ updates:
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/"
schedule:
Expand Down
69 changes: 20 additions & 49 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: ["main"]
schedule:
- cron: '43 9 * * 3'
- cron: "20 12 * * 5"

jobs:
analyze:
Expand All @@ -32,39 +20,22 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
language: ["go"]

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# 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

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
8 changes: 4 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Go
on:
push:
tags:
- '*'
branches: [ main ]
- "*"
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

permissions:
contents: write
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: "1.20"

- name: Test
run: go test -v ./...
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
permissions:
contents: read
pull-requests: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
only-new-issues: true
args: --timeout=10m
23 changes: 0 additions & 23 deletions .github/workflows/linter.yml

This file was deleted.

13 changes: 3 additions & 10 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@ builds:
- linux
- windows
- darwin
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
name_template: "checksums.txt"
release:
draft: true
prerelease: auto
Expand All @@ -31,5 +24,5 @@ changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- "^docs:"
- "^test:"
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/golangci/golangci-lint
rev: v1.53.3
hooks:
- id: golangci-lint
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.22
hooks:
- id: shellcheck
- id: gofmt
- id: goimports
5 changes: 3 additions & 2 deletions cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

"github.com/pecigonzalo/loro/lib"
"github.com/segmentio/events"
"github.com/segmentio/events/v2"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -56,6 +56,7 @@ func init() {
}

func get(cmd *cobra.Command, args []string) error {
ctx := context.Background()
group := "/"

if len(args) > 0 {
Expand Down Expand Up @@ -86,7 +87,7 @@ func get(cmd *cobra.Command, args []string) error {
}

// Try and fetch the group to verify it exists
_, err = logReader.GetGroup()
_, err = logReader.GetGroup(ctx)
if err != nil {
return err
}
Expand Down
4 changes: 3 additions & 1 deletion cmd/groups.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"context"
"fmt"
"os"
"text/tabwriter"
Expand All @@ -24,6 +25,7 @@ func init() {
}

func groups(cmd *cobra.Command, args []string) error {
ctx := context.Background()
group := "/"

if len(args) > 0 {
Expand All @@ -45,7 +47,7 @@ func groups(cmd *cobra.Command, args []string) error {
return err
}

groups, err := logReader.ListGroups()
groups, err := logReader.ListGroups(ctx)
if err != nil {
return err
}
Expand Down
4 changes: 3 additions & 1 deletion cmd/streams.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"context"
"fmt"
"os"
"sort"
Expand All @@ -23,6 +24,7 @@ func init() {
}

func streams(cmd *cobra.Command, args []string) error {
ctx := context.Background()
group := "/"

if len(args) > 0 {
Expand All @@ -44,7 +46,7 @@ func streams(cmd *cobra.Command, args []string) error {
return err
}

streams, err := logReader.ListStreams()
streams, err := logReader.ListStreams(ctx)
if err != nil {
return err
}
Expand Down
43 changes: 43 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
description = "Loro Local Build";

inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05-small";
inputs.flake-utils.url = "github:numtide/flake-utils";

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in
{
devShell = pkgs.mkShell {
buildInputs = [
pkgs.go
pkgs.gotools
pkgs.goreleaser
pkgs.golangci-lint
pkgs.gopls
pkgs.go-outline
pkgs.gopkgs
];
};
});
}
Loading