Прикинул метод Open и Delete, Update пока не до делал. Co-authored-by: Gorbunov Kirill Andreevich <kgorbunov@mtsbank.ru> Reviewed-on: #9 Co-authored-by: Кирилл Горбунов <kirya_gorbunov_2015@mail.ru> Co-committed-by: Кирилл Горбунов <kirya_gorbunov_2015@mail.ru>
This commit is contained in:
parent
c9a16829fd
commit
ec5c6c591d
3
.gitignore
vendored
3
.gitignore
vendored
@ -30,3 +30,6 @@ cmd/pkgdash/pkgdash
|
||||
cmd/pkgdashcli/pkgdashcli
|
||||
*.sqlite
|
||||
*.db
|
||||
.gitea
|
||||
.github
|
||||
.gitlab
|
66
LICENSE
66
LICENSE
@ -2,72 +2,72 @@ Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright 2023 unistack-org
|
||||
Copyright 2023 unistack-org
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
limitations under the License.
|
8
Makefile
8
Makefile
@ -2,6 +2,14 @@
|
||||
build:
|
||||
CGO_ENABLED=0 go build -o bin/app -mod=readonly git.unistack.org/unistack-org/pkgdash/cmd/pkgdash
|
||||
|
||||
.PHONY: buildcli
|
||||
buildcli:
|
||||
CGO_ENABLED=0 go build -o bin/app -mod=readonly git.unistack.org/unistack-org/pkgdash/cmd/pkgdashcli
|
||||
|
||||
.PHONY: cli
|
||||
cli:
|
||||
go install git.unistack.org/unistack-org/pkgdash/cmd/pkgdashcli
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
go test -v ./... -race -cover
|
||||
|
45
README.md
45
README.md
@ -1,2 +1,47 @@
|
||||
# pkgdash
|
||||
|
||||
# pkgdashcli
|
||||
|
||||
## Installation
|
||||
|
||||
Use any of the following for a pain-free installation:
|
||||
|
||||
* If you have [`go`](https://go.dev/doc/install) installed, you can run:
|
||||
```shell
|
||||
go install git.unistack.org/unistack-org/pkgdash/cmd/pkgdashcli@latest
|
||||
```
|
||||
|
||||
## Config
|
||||
|
||||
Before starting, you should fill out the configuration file.
|
||||
The file must be located in the .gitea, .gitlab, .github directory
|
||||
according to the git type you are using.
|
||||
|
||||
- branches - array of main branches
|
||||
- source - information about the version control system
|
||||
- source.type - type of version control system
|
||||
- source.apiurl - path to the version control system api
|
||||
- source.repository - repository name
|
||||
- source.owner - username of the repository owner
|
||||
- update_opt - dependency update options
|
||||
- update_opt.pre - update to pre-release versions
|
||||
- update_opt.major - compare only major versions in modules
|
||||
- update_opt.up_major - raise the version according to major
|
||||
- update_opt.cached - caching
|
||||
|
||||
### Config.Example
|
||||
|
||||
```yaml
|
||||
# .gitea/pkgdashcli.yaml
|
||||
branches: [master]
|
||||
source:
|
||||
type: gitea
|
||||
apiurl: https://git.unistack.org/api/v1
|
||||
repository: pkgdash
|
||||
owner: unistack
|
||||
update_opt:
|
||||
pre: false
|
||||
major: false
|
||||
up_major: false
|
||||
cached: true
|
||||
```
|
@ -1507,10 +1507,10 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/isFunction */ 2971);
|
||||
|
||||
|
||||
function throwError(errorOrErrorFactory, scheduler) {
|
||||
const errorFactory = (0,_util_isFunction__WEBPACK_IMPORTED_MODULE_0__.isFunction)(errorOrErrorFactory) ? errorOrErrorFactory : () => errorOrErrorFactory;
|
||||
function throwError(errorOrErroractory, scheduler) {
|
||||
const Erroractory = (0,_util_isFunction__WEBPACK_IMPORTED_MODULE_0__.isFunction)(errorOrErroractory) ? errorOrErroractory : () => errorOrErroractory;
|
||||
|
||||
const init = subscriber => subscriber.error(errorFactory());
|
||||
const init = subscriber => subscriber.error(Erroractory());
|
||||
|
||||
return new _Observable__WEBPACK_IMPORTED_MODULE_1__.Observable(scheduler ? subscriber => scheduler.schedule(init, 0, subscriber) : init);
|
||||
}
|
||||
@ -2963,17 +2963,17 @@ __webpack_require__.r(__webpack_exports__);
|
||||
|
||||
|
||||
|
||||
function throwIfEmpty(errorFactory = defaultErrorFactory) {
|
||||
function throwIfEmpty(Erroractory = defaultErroractory) {
|
||||
return (0,_util_lift__WEBPACK_IMPORTED_MODULE_0__.operate)((source, subscriber) => {
|
||||
let hasValue = false;
|
||||
source.subscribe(new _OperatorSubscriber__WEBPACK_IMPORTED_MODULE_1__.OperatorSubscriber(subscriber, value => {
|
||||
hasValue = true;
|
||||
subscriber.next(value);
|
||||
}, () => hasValue ? subscriber.complete() : subscriber.error(errorFactory())));
|
||||
}, () => hasValue ? subscriber.complete() : subscriber.error(Erroractory())));
|
||||
});
|
||||
}
|
||||
|
||||
function defaultErrorFactory() {
|
||||
function defaultErroractory() {
|
||||
return new _util_EmptyError__WEBPACK_IMPORTED_MODULE_2__.EmptyError();
|
||||
}
|
||||
|
||||
@ -4996,243 +4996,243 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
|
||||
/* harmony export */ "__values": () => (/* binding */ __values)
|
||||
/* harmony export */ });
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
function __extends(d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
var __assign = function() {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return __assign.apply(this, arguments);
|
||||
}
|
||||
|
||||
function __rest(s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
}
|
||||
|
||||
function __param(paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
}
|
||||
|
||||
function __metadata(metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
}
|
||||
|
||||
function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
function __generator(thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
}
|
||||
|
||||
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
function __exportStar(m, o) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
||||
}
|
||||
|
||||
function __values(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
}
|
||||
|
||||
function __read(o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
function __spread() {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
}
|
||||
|
||||
function __spreadArray(to, from) {
|
||||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
||||
to[j] = from[i];
|
||||
return to;
|
||||
}
|
||||
|
||||
function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
|
||||
function __asyncGenerator(thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
}
|
||||
|
||||
function __asyncDelegator(o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
}
|
||||
|
||||
function __asyncValues(o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
}
|
||||
|
||||
function __makeTemplateObject(cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
function __importStar(mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
}
|
||||
|
||||
function __importDefault(mod) {
|
||||
return (mod && mod.__esModule) ? mod : { default: mod };
|
||||
}
|
||||
|
||||
function __classPrivateFieldGet(receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
}
|
||||
|
||||
function __classPrivateFieldSet(receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
}
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
function __extends(d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
var __assign = function() {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return __assign.apply(this, arguments);
|
||||
}
|
||||
|
||||
function __rest(s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
}
|
||||
|
||||
function __param(paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
}
|
||||
|
||||
function __metadata(metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
}
|
||||
|
||||
function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
function __generator(thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
}
|
||||
|
||||
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
function __exportStar(m, o) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
||||
}
|
||||
|
||||
function __values(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
}
|
||||
|
||||
function __read(o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
function __spread() {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
}
|
||||
|
||||
function __spreadArray(to, from) {
|
||||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
||||
to[j] = from[i];
|
||||
return to;
|
||||
}
|
||||
|
||||
function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
|
||||
function __asyncGenerator(thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
}
|
||||
|
||||
function __asyncDelegator(o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
}
|
||||
|
||||
function __asyncValues(o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
}
|
||||
|
||||
function __makeTemplateObject(cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
function __importStar(mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
}
|
||||
|
||||
function __importDefault(mod) {
|
||||
return (mod && mod.__esModule) ? mod : { default: mod };
|
||||
}
|
||||
|
||||
function __classPrivateFieldGet(receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
}
|
||||
|
||||
function __classPrivateFieldSet(receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
@ -67599,19 +67599,19 @@ class EventEmitter_ extends rxjs__WEBPACK_IMPORTED_MODULE_0__.Subject {
|
||||
subscribe(observerOrNext, error, complete) {
|
||||
let nextFn = observerOrNext;
|
||||
|
||||
let errorFn = error || (() => null);
|
||||
let Errorn = error || (() => null);
|
||||
|
||||
let completeFn = complete;
|
||||
|
||||
if (observerOrNext && typeof observerOrNext === 'object') {
|
||||
const observer = observerOrNext;
|
||||
nextFn = observer.next?.bind(observer);
|
||||
errorFn = observer.error?.bind(observer);
|
||||
Errorn = observer.error?.bind(observer);
|
||||
completeFn = observer.complete?.bind(observer);
|
||||
}
|
||||
|
||||
if (this.__isAsync) {
|
||||
errorFn = _wrapInTimeout(errorFn);
|
||||
Errorn = _wrapInTimeout(Errorn);
|
||||
|
||||
if (nextFn) {
|
||||
nextFn = _wrapInTimeout(nextFn);
|
||||
@ -67624,7 +67624,7 @@ class EventEmitter_ extends rxjs__WEBPACK_IMPORTED_MODULE_0__.Subject {
|
||||
|
||||
const sink = super.subscribe({
|
||||
next: nextFn,
|
||||
error: errorFn,
|
||||
error: Errorn,
|
||||
complete: completeFn
|
||||
});
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -56,7 +56,7 @@ func main() {
|
||||
|
||||
logger.DefaultLogger = zlogger.NewLogger(zlogger.ReportCaller(), logger.WithLevel(logger.DebugLevel), logger.WithCallerSkipCount(4))
|
||||
if err := logger.DefaultLogger.Init(); err != nil {
|
||||
logger.Fatalf(ctx, "failed to init logger")
|
||||
logger.Fatal(ctx, "failed to init logger")
|
||||
}
|
||||
|
||||
cfg := appconfig.NewConfig(appName, AppVersion) // create new empty config
|
||||
@ -96,11 +96,11 @@ func main() {
|
||||
vc,
|
||||
}, config.LoadOverride(true),
|
||||
); err != nil {
|
||||
logger.Fatalf(ctx, "failed to load config: %v", err)
|
||||
logger.Fatal(ctx, "failed to load config: %v", err)
|
||||
}
|
||||
|
||||
if err := config.Validate(ctx, cfg); err != nil {
|
||||
logger.Fatalf(ctx, "failed to validate config: %v", err)
|
||||
logger.Fatal(ctx, "failed to validate config: %v", err)
|
||||
}
|
||||
|
||||
swaggerui.Config["url"] = "../service.swagger.yaml"
|
||||
@ -119,12 +119,12 @@ func main() {
|
||||
micro.Name(cfg.Server.Name),
|
||||
micro.Version(cfg.Server.Version),
|
||||
); err != nil {
|
||||
logger.Fatalf(ctx, "failed to init service: %v", err)
|
||||
logger.Fatal(ctx, "failed to init service: %v", err)
|
||||
}
|
||||
|
||||
assetsUI, err := fs.Sub(assets, "assets/ui")
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to get assets: %v", err)
|
||||
logger.Fatal(ctx, "failed to get assets: %v", err)
|
||||
}
|
||||
|
||||
if err := svc.Server("http").Init(
|
||||
@ -138,26 +138,26 @@ func main() {
|
||||
httpsrv.PathHandler(http.MethodHead, "/ui/*", spahandler.Handler("/ui/", assetsUI)),
|
||||
httpsrv.PathHandler(http.MethodGet, "/swagger-ui/*", swaggerui.Handler("/swagger-ui")),
|
||||
); err != nil {
|
||||
logger.Fatalf(ctx, "failed to init service: %v", err)
|
||||
logger.Fatal(ctx, "failed to init service: %v", err)
|
||||
}
|
||||
|
||||
if err := database.ParseDSN(cfg.Database); err != nil {
|
||||
logger.Fatalf(ctx, "failed to init database: %v", err)
|
||||
logger.Fatal(ctx, "failed to init database: %v", err)
|
||||
}
|
||||
|
||||
db, err := database.Connect(ctx, cfg.Database, logger.DefaultLogger)
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to connect database: %v", err)
|
||||
logger.Fatal(ctx, "failed to connect database: %v", err)
|
||||
}
|
||||
|
||||
store, err := storage.NewStorage(cfg.Database.Type, db)
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to init storage: %v", err)
|
||||
logger.Fatal(ctx, "failed to init storage: %v", err)
|
||||
}
|
||||
|
||||
h, err := handler.NewHandler(store)
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to create handler: %v", err)
|
||||
logger.Fatal(ctx, "failed to create handler: %v", err)
|
||||
}
|
||||
|
||||
log := logger.NewLogger(
|
||||
@ -165,11 +165,11 @@ func main() {
|
||||
logger.WithCallerSkipCount(3),
|
||||
)
|
||||
if err := svc.Init(micro.Logger(log)); err != nil {
|
||||
logger.Fatalf(ctx, "failed to init service: %v", err)
|
||||
logger.Fatal(ctx, "failed to init service: %v", err)
|
||||
}
|
||||
|
||||
if err := pb.RegisterPkgdashServiceServer(svc.Server("http"), h); err != nil {
|
||||
logger.Fatalf(ctx, "failed to register handler: %v", err)
|
||||
logger.Fatal(ctx, "failed to register handler: %v", err)
|
||||
}
|
||||
|
||||
intsvc := httpsrv.NewServer(
|
||||
@ -179,29 +179,29 @@ func main() {
|
||||
)
|
||||
|
||||
if err := intsvc.Init(); err != nil {
|
||||
logger.Fatalf(ctx, "failed to init http srv: %v", err)
|
||||
logger.Fatal(ctx, "failed to init http srv: %v", err)
|
||||
}
|
||||
|
||||
if err := healthhandler.RegisterHealthServiceServer(intsvc, healthhandler.NewHandler()); err != nil {
|
||||
logger.Fatalf(ctx, "failed to set http handler: %v", err)
|
||||
logger.Fatal(ctx, "failed to set http handler: %v", err)
|
||||
}
|
||||
|
||||
if err := meterhandler.RegisterMeterServiceServer(intsvc, meterhandler.NewHandler()); err != nil {
|
||||
logger.Fatalf(ctx, "failed to set http handler: %v", err)
|
||||
logger.Fatal(ctx, "failed to set http handler: %v", err)
|
||||
}
|
||||
|
||||
if err := intsvc.Start(); err != nil {
|
||||
logger.Fatalf(ctx, "failed to run http srv: %v", err)
|
||||
logger.Fatal(ctx, "failed to run http srv: %v", err)
|
||||
}
|
||||
|
||||
cw, err := vc.Watch(ctx, config.WatchCoalesce(true), config.WatchInterval(1*time.Second, 5*time.Second))
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to watch config: %v", err)
|
||||
logger.Fatal(ctx, "failed to watch config: %v", err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err := cw.Stop(); err != nil {
|
||||
logger.Error(ctx, err)
|
||||
logger.Error(ctx, err.Error())
|
||||
}
|
||||
}()
|
||||
|
||||
@ -209,11 +209,11 @@ func main() {
|
||||
for {
|
||||
changes, err := cw.Next()
|
||||
if err != nil {
|
||||
logger.Errorf(ctx, "failed to get config update: %v", err)
|
||||
logger.Error(ctx, "failed to get config update: %v", err)
|
||||
}
|
||||
for k, v := range changes {
|
||||
if err = rutil.SetFieldByPath(cfg, v, k); err != nil {
|
||||
logger.Errorf(ctx, "failed to set config update: %v", err)
|
||||
logger.Error(ctx, "failed to set config update: %v", err)
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -222,7 +222,7 @@ func main() {
|
||||
switch k {
|
||||
case "Server.LoggerLevel":
|
||||
if lvl, ok := changes[k].(string); ok {
|
||||
logger.Infof(ctx, "logger level changed to %s", lvl)
|
||||
logger.Info(ctx, "logger level changed to %s", lvl)
|
||||
logger.DefaultLogger.Level(logger.ParseLevel(lvl))
|
||||
}
|
||||
}
|
||||
@ -236,6 +236,6 @@ func main() {
|
||||
}()
|
||||
|
||||
if err = svc.Run(); err != nil {
|
||||
logger.Fatalf(ctx, "failed to run svc: %v", err)
|
||||
logger.Fatal(ctx, "failed to run svc: %v", err)
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,9 @@ import (
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/configcli"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/modules"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/source"
|
||||
"github.com/go-git/go-git/v5"
|
||||
gitconfig "github.com/go-git/go-git/v5/config"
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
@ -26,8 +28,10 @@ import (
|
||||
fileconfig "go.unistack.org/micro-config-file/v4"
|
||||
"go.unistack.org/micro/v4/config"
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
"go.unistack.org/micro/v4/logger/slog"
|
||||
"go.unistack.org/micro/v4/options"
|
||||
"golang.org/x/mod/modfile"
|
||||
"golang.org/x/mod/semver"
|
||||
)
|
||||
|
||||
// https://docs.github.com/ru/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
@ -37,12 +41,6 @@ var (
|
||||
DefaultPullRequestBody = `Bumps {{.Name}} from {{.VersionOld}} to {{.VersionNew}}`
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
PullRequestTitle string `json:"pull_request_title" yaml:"pull_request_title"`
|
||||
PullRequestBody string `json:"pull_request_body" yaml:"pull_request_body"`
|
||||
Branches []string `json:"branches" yaml:"branches"`
|
||||
}
|
||||
|
||||
var (
|
||||
configFiles = []string{
|
||||
"dependabot.yml",
|
||||
@ -66,47 +64,55 @@ type Data struct {
|
||||
Modules map[string]modules.Update
|
||||
}
|
||||
|
||||
func main() {
|
||||
func pkgdashcli() {
|
||||
var err error
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
if err = logger.DefaultLogger.Init(logger.WithCallerSkipCount(3)); err != nil {
|
||||
logger.Errorf(ctx, "logger init error: %v", err)
|
||||
logger.DefaultLogger = slog.NewLogger()
|
||||
|
||||
if err = logger.DefaultLogger.Init(logger.WithCallerSkipCount(3), logger.WithLevel(logger.DebugLevel)); err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("logger init error: %v", err))
|
||||
}
|
||||
|
||||
cfg := &Config{}
|
||||
cfg := configcli.NewConfig()
|
||||
|
||||
if err = config.Load(ctx,
|
||||
[]config.Config{
|
||||
config.NewConfig(
|
||||
config.Struct(cfg),
|
||||
),
|
||||
|
||||
envconfig.NewConfig(
|
||||
config.Struct(cfg),
|
||||
),
|
||||
},
|
||||
config.LoadOverride(true),
|
||||
); err != nil {
|
||||
logger.Fatalf(ctx, "failed to load config: %v", err)
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to load config: %v", err))
|
||||
}
|
||||
|
||||
for _, configDir := range configDirs {
|
||||
for _, configFile := range configFiles {
|
||||
logger.Info(ctx, fmt.Sprintf("path: %s", filepath.Join(configDir, configFile)))
|
||||
c := fileconfig.NewConfig(
|
||||
config.AllowFail(true),
|
||||
config.AllowFail(false),
|
||||
config.Struct(cfg),
|
||||
options.Codec(yamlcodec.NewCodec()),
|
||||
fileconfig.Path(filepath.Join(configDir, configFile)),
|
||||
fileconfig.Path(".gitea/pkgdashcli.yaml"),
|
||||
)
|
||||
err = c.Init(options.Context(ctx))
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to init config: %v", err))
|
||||
}
|
||||
if err = c.Load(ctx, config.LoadOverride(true)); err != nil {
|
||||
logger.Fatalf(ctx, "failed to load config: %v", err)
|
||||
logger.Error(ctx, fmt.Sprintf("failed to load config: %v", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("Load config... %s", cfg.Source.Repository))
|
||||
|
||||
if cfg.PullRequestBody == "" {
|
||||
cfg.PullRequestBody = DefaultPullRequestBody
|
||||
}
|
||||
@ -136,15 +142,28 @@ func main() {
|
||||
mvs := make(map[string]modules.Update)
|
||||
|
||||
updateOptions := modules.UpdateOptions{
|
||||
Pre: false,
|
||||
Major: false,
|
||||
Cached: true,
|
||||
Pre: cfg.UpdateOpt.Pre,
|
||||
Major: cfg.UpdateOpt.Major,
|
||||
UpMajor: cfg.UpdateOpt.UpMajor,
|
||||
Cached: cfg.UpdateOpt.Cached,
|
||||
OnUpdate: func(u modules.Update) {
|
||||
var modpath string // new mod path with major
|
||||
if u.Err != nil {
|
||||
logger.Errorf(ctx, "%s: failed: %v", u.Module.Path, u.Err)
|
||||
logger.Error(ctx, fmt.Sprintf("%s: failed: %v", u.Module.Path, u.Err))
|
||||
return
|
||||
}
|
||||
mvs[u.Module.Path] = u
|
||||
modpath = u.Module.Path
|
||||
v := semver.Major(u.Version)
|
||||
p := modules.ModPrefix(modpath)
|
||||
if !strings.HasPrefix(u.Module.Version, v) && v != "v1" && v != "v0" {
|
||||
switch strings.HasPrefix(u.Module.Path, "gopkg.in") {
|
||||
case true:
|
||||
modpath = p + "." + v
|
||||
case false:
|
||||
modpath = p + "/" + v
|
||||
}
|
||||
}
|
||||
mvs[modpath] = u
|
||||
},
|
||||
}
|
||||
|
||||
@ -154,21 +173,50 @@ func main() {
|
||||
|
||||
modules.Updates(updateOptions)
|
||||
|
||||
repoMgmt := getRepoMgmt()
|
||||
if repoMgmt == "unknown" {
|
||||
logger.Fatalf(ctx, "failed to get repo management")
|
||||
/*var repoGit, tokenGit string // nameGit = gitea, repoGit = pkgdash, tokenGit = {xxx}, machine??
|
||||
if cfg.Source != nil {
|
||||
repoGit = cfg.Source.TypeGit
|
||||
tokenGit = cfg.Source.Token
|
||||
} else {
|
||||
repoGit = getRepoMgmt()
|
||||
if repoGit == "unknown" {
|
||||
logger.Fatal(ctx, "pkgdash/main failed to get repo management")
|
||||
}
|
||||
}
|
||||
|
||||
switch repoMgmt {
|
||||
usr, err := user.Current()
|
||||
if err != nil {
|
||||
logger.Error(ctx, "pkgdash/main can t get info user: %s", err)
|
||||
} else {
|
||||
n, err := netrc.Parse(filepath.Join(usr.HomeDir, ".netrc"))
|
||||
if err != nil {
|
||||
logger.Error(ctx, "pkgdash/main can t parse .netrc: %s", err)
|
||||
}
|
||||
tokenGit = n.Machine(repoGit).Get("password")
|
||||
}
|
||||
|
||||
switch repoGit {
|
||||
case "gitea":
|
||||
for _, branch := range cfg.Branches {
|
||||
err = giteaPullRequest(ctx, cfg, branch, mvs)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to create pr: %v", err)
|
||||
logger.Info(ctx, fmt.Sprintf("cfg: %v", cfg))
|
||||
|
||||
gitSource := source.NewSourceControl(*cfg)
|
||||
for _, branch := range cfg.Branches {
|
||||
for pathMod, mod := range mvs {
|
||||
logger.Debugf(ctx, fmt.Sprintf("Start update %s from %s to %s", pathMod, mod.Module.Version, mod.Version))
|
||||
err = gitSource.RequestOpen(ctx, branch, pathMod, mod)
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to create pr: %v", err))
|
||||
}
|
||||
logger.Debugf(ctx, fmt.Sprintf("Update successful for %s", pathMod))
|
||||
}
|
||||
}
|
||||
//err = gitSource.RequestClose(ctx, "master", "modernc.org/ccgo/v4")
|
||||
logger.Info(ctx, "Pkgdash successfully updated dependencies")
|
||||
}
|
||||
|
||||
func getRepoMgmt() string {
|
||||
@ -192,7 +240,7 @@ func getRepoMgmt() string {
|
||||
}
|
||||
}
|
||||
|
||||
func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[string]modules.Update) error {
|
||||
func giteaPullRequest(ctx context.Context, cfg *configcli.Config, branch string, mods map[string]modules.Update) error {
|
||||
envAPIURL := os.Getenv("GITHUB_API_URL")
|
||||
envREPOSITORY := os.Getenv("GITHUB_REPOSITORY")
|
||||
envTOKEN := os.Getenv("GITHUB_TOKEN")
|
||||
@ -202,34 +250,34 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
|
||||
|
||||
tplTitle, err := template.New("pull_request_title").Parse(cfg.PullRequestTitle)
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to parse template: %v", err)
|
||||
logger.Fatal(ctx, "failed to parse template: %v", err)
|
||||
}
|
||||
|
||||
wTitle := bytes.NewBuffer(nil)
|
||||
|
||||
tplBody, err := template.New("pull_request_body").Parse(cfg.PullRequestBody)
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to parse template: %v", err)
|
||||
logger.Fatal(ctx, "failed to parse template: %v", err)
|
||||
}
|
||||
|
||||
wBody := bytes.NewBuffer(nil)
|
||||
|
||||
repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to open repo: %v", err)
|
||||
logger.Fatal(ctx, "failed to open repo: %v", err)
|
||||
}
|
||||
|
||||
if err = repo.FetchContext(ctx, &git.FetchOptions{
|
||||
Auth: &httpauth.BasicAuth{Username: envTOKEN, Password: envTOKEN},
|
||||
Force: true,
|
||||
}); err != nil && err != git.NoErrAlreadyUpToDate {
|
||||
logger.Fatalf(ctx, "failed to fetch repo: %v", err)
|
||||
logger.Fatal(ctx, "failed to fetch repo: %v", err)
|
||||
}
|
||||
|
||||
var headRef *plumbing.Reference
|
||||
refIter, err := repo.Branches()
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to get branches: %v", err)
|
||||
logger.Fatal(ctx, "failed to get branches: %v", err)
|
||||
}
|
||||
for {
|
||||
ref, err := refIter.Next()
|
||||
@ -244,14 +292,14 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
|
||||
refIter.Close()
|
||||
|
||||
if headRef == nil {
|
||||
logger.Fatalf(ctx, "failed to get repo branch head")
|
||||
logger.Fatal(ctx, "failed to get repo branch head")
|
||||
}
|
||||
|
||||
logger.Infof(ctx, "repo head %s", headRef)
|
||||
logger.Info(ctx, "repo head %s", headRef)
|
||||
|
||||
wtree, err := repo.Worktree()
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to get worktree: %v", err)
|
||||
logger.Fatal(ctx, "failed to get worktree: %v", err)
|
||||
}
|
||||
|
||||
type giteaPull struct {
|
||||
@ -282,13 +330,13 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(buf, &pulls); err != nil {
|
||||
logger.Fatalf(ctx, "failed to decode response %s err: %v", buf, err)
|
||||
logger.Fatal(ctx, "failed to decode response %s err: %v", buf, err)
|
||||
}
|
||||
|
||||
for path := range mods {
|
||||
for _, pull := range pulls {
|
||||
if strings.Contains(pull.Title, path) && pull.Base.Ref == branch {
|
||||
logger.Infof(ctx, "skip %s as pr already exists %s", path, pull.URL)
|
||||
logger.Info(ctx, "skip %s as pr already exists %s", path, pull.URL)
|
||||
delete(mods, path)
|
||||
}
|
||||
}
|
||||
@ -298,11 +346,11 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
|
||||
wTitle.Reset()
|
||||
wBody.Reset()
|
||||
|
||||
logger.Infof(ctx, "update %s from %s to %s", path, mod.Module.Version, mod.Version)
|
||||
logger.Info(ctx, "update %s from %s to %s", path, mod.Module.Version, mod.Version)
|
||||
|
||||
logger.Infof(ctx, "reset worktree")
|
||||
logger.Info(ctx, "reset worktree")
|
||||
if err = wtree.Reset(&git.ResetOptions{Mode: git.HardReset}); err != nil {
|
||||
logger.Fatalf(ctx, "failed to reset repo branch: %v", err)
|
||||
logger.Fatal(ctx, "failed to reset repo branch: %v", err)
|
||||
}
|
||||
|
||||
if err = wtree.PullContext(ctx, &git.PullOptions{
|
||||
@ -312,17 +360,17 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
|
||||
Force: true,
|
||||
RemoteName: "origin",
|
||||
}); err != nil && err != git.NoErrAlreadyUpToDate {
|
||||
logger.Fatalf(ctx, "failed to pull repo: %v", err)
|
||||
logger.Fatal(ctx, "failed to pull repo: %v", err)
|
||||
}
|
||||
|
||||
logger.Infof(ctx, "checkout ref %s", headRef)
|
||||
logger.Info(ctx, "checkout ref %s", headRef)
|
||||
if err = wtree.Checkout(&git.CheckoutOptions{
|
||||
Hash: headRef.Hash(),
|
||||
Branch: plumbing.NewBranchReferenceName(fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version)),
|
||||
Create: true,
|
||||
Force: true,
|
||||
}); err != nil {
|
||||
logger.Fatalf(ctx, "failed to checkout tree: %v", err)
|
||||
logger.Fatal(ctx, "failed to checkout tree: %v", err)
|
||||
}
|
||||
|
||||
epath, err := exec.LookPath("go")
|
||||
@ -330,7 +378,7 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to find go command: %v", err)
|
||||
logger.Fatal(ctx, "failed to find go command: %v", err)
|
||||
}
|
||||
|
||||
var cmd *exec.Cmd
|
||||
@ -338,25 +386,25 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
|
||||
|
||||
cmd = exec.CommandContext(ctx, epath, "mod", "edit", fmt.Sprintf("-require=%s@%s", path, mod.Version))
|
||||
if out, err = cmd.CombinedOutput(); err != nil {
|
||||
logger.Fatalf(ctx, "failed to run go mod edit: %s err: %v", out, err)
|
||||
logger.Fatal(ctx, "failed to run go mod edit: %s err: %v", out, err)
|
||||
}
|
||||
|
||||
cmd = exec.CommandContext(ctx, epath, "mod", "tidy")
|
||||
if out, err = cmd.CombinedOutput(); err != nil {
|
||||
logger.Fatalf(ctx, "failed to run go mod tidy: %s err: %v", out, err)
|
||||
logger.Fatal(ctx, "failed to run go mod tidy: %s err: %v", out, err)
|
||||
}
|
||||
|
||||
logger.Infof(ctx, "worktree add go.mod")
|
||||
logger.Info(ctx, "worktree add go.mod")
|
||||
if _, err = wtree.Add("go.mod"); err != nil {
|
||||
logger.Fatalf(ctx, "failed to add file: %v", err)
|
||||
logger.Fatal(ctx, "failed to add file: %v", err)
|
||||
}
|
||||
|
||||
logger.Infof(ctx, "worktree add go.sum")
|
||||
logger.Info(ctx, "worktree add go.sum")
|
||||
if _, err = wtree.Add("go.sum"); err != nil {
|
||||
logger.Fatalf(ctx, "failed to add file: %v", err)
|
||||
logger.Fatal(ctx, "failed to add file: %v", err)
|
||||
}
|
||||
|
||||
logger.Infof(ctx, "worktree commit")
|
||||
logger.Info(ctx, "worktree commit")
|
||||
_, err = wtree.Commit(wTitle.String(), &git.CommitOptions{
|
||||
Parents: []plumbing.Hash{headRef.Hash()},
|
||||
Author: &object.Signature{
|
||||
@ -366,27 +414,27 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
logger.Fatalf(ctx, "failed to commit: %v", err)
|
||||
logger.Fatal(ctx, "failed to commit: %v", err)
|
||||
}
|
||||
|
||||
// newref := plumbing.NewHashReference(plumbing.ReferenceName(fmt.Sprintf("refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version)), headRef.Hash())
|
||||
|
||||
/*
|
||||
if err = repo.Storer.SetReference(newref); err != nil {
|
||||
logger.Fatalf(ctx, "failed to create repo branch: %v", err)
|
||||
logger.Fatal(ctx, "failed to create repo branch: %v", err)
|
||||
}
|
||||
*/
|
||||
|
||||
refspec := gitconfig.RefSpec(fmt.Sprintf("+refs/heads/pkgdash/go_modules/%s-%s:refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version, path, mod.Version))
|
||||
|
||||
logger.Infof(ctx, "try to push refspec %s", refspec)
|
||||
logger.Info(ctx, "try to push refspec %s", refspec)
|
||||
|
||||
if err = repo.PushContext(ctx, &git.PushOptions{
|
||||
RefSpecs: []gitconfig.RefSpec{refspec},
|
||||
Auth: &httpauth.BasicAuth{Username: envTOKEN, Password: envTOKEN},
|
||||
Force: true,
|
||||
}); err != nil {
|
||||
logger.Fatalf(ctx, "failed to push repo branch: %v", err)
|
||||
logger.Fatal(ctx, "failed to push repo branch: %v", err)
|
||||
}
|
||||
|
||||
data := map[string]string{
|
||||
@ -396,10 +444,10 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
|
||||
}
|
||||
|
||||
if err = tplTitle.Execute(wTitle, data); err != nil {
|
||||
logger.Fatalf(ctx, "failed to execute template: %v", err)
|
||||
logger.Fatal(ctx, "failed to execute template: %v", err)
|
||||
}
|
||||
if err = tplBody.Execute(wBody, data); err != nil {
|
||||
logger.Fatalf(ctx, "failed to execute template: %v", err)
|
||||
logger.Fatal(ctx, "failed to execute template: %v", err)
|
||||
}
|
||||
|
||||
body := map[string]string{
|
||||
@ -408,14 +456,14 @@ func giteaPullRequest(ctx context.Context, cfg *Config, branch string, mods map[
|
||||
"head": fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version),
|
||||
"title": wTitle.String(),
|
||||
}
|
||||
logger.Infof(ctx, "raw body: %#+v", body)
|
||||
logger.Info(ctx, "raw body: %#+v", body)
|
||||
|
||||
buf, err = json.Marshal(body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Infof(ctx, "marshal body: %s", buf)
|
||||
logger.Info(ctx, "marshal body: %s", buf)
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, envAPIURL+"/repos/"+envREPOSITORY+"/pulls?token="+envTOKEN, bytes.NewReader(buf))
|
||||
if err != nil {
|
||||
|
7
cmd/pkgdashcli/pkgdashcli.go
Normal file
7
cmd/pkgdashcli/pkgdashcli.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "git.unistack.org/unistack-org/pkgdash/internal/cli"
|
||||
|
||||
func main() {
|
||||
cli.Execute()
|
||||
}
|
57
go.mod
57
go.mod
@ -3,34 +3,43 @@ module git.unistack.org/unistack-org/pkgdash
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/envoyproxy/protoc-gen-validate v1.0.2
|
||||
github.com/envoyproxy/protoc-gen-validate v1.0.4
|
||||
github.com/go-git/go-git/v5 v5.8.1
|
||||
github.com/golang-migrate/migrate/v4 v4.15.1
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c
|
||||
github.com/jmoiron/sqlx v1.3.1
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/stretchr/testify v1.8.3
|
||||
go.unistack.org/micro-client-http/v4 v4.0.2
|
||||
go.unistack.org/micro-codec-json/v4 v4.0.0
|
||||
go.unistack.org/micro-codec-jsonpb/v4 v4.0.0
|
||||
go.unistack.org/micro-codec-yaml/v4 v4.0.0
|
||||
go.unistack.org/micro-config-env/v4 v4.0.1
|
||||
go.unistack.org/micro-config-file/v4 v4.0.1
|
||||
go.unistack.org/micro-config-vault/v4 v4.0.2
|
||||
go.unistack.org/micro-logger-zerolog/v4 v4.0.3
|
||||
go.unistack.org/micro-meter-victoriametrics/v4 v4.0.1
|
||||
go.unistack.org/micro-proto/v4 v4.0.1
|
||||
go.unistack.org/micro-server-http/v4 v4.0.13
|
||||
go.unistack.org/micro/v4 v4.0.7
|
||||
go.unistack.org/micro/v4 v4.0.18
|
||||
go.unistack.org/protoc-gen-go-micro/v4 v4.0.7
|
||||
golang.org/x/mod v0.12.0
|
||||
golang.org/x/sync v0.3.0
|
||||
golang.org/x/tools v0.11.0
|
||||
google.golang.org/protobuf v1.31.0
|
||||
golang.org/x/mod v0.14.0
|
||||
golang.org/x/sync v0.6.0
|
||||
golang.org/x/tools v0.13.0
|
||||
google.golang.org/protobuf v1.33.0
|
||||
modernc.org/sqlite v1.21.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/silas/dag v0.0.0-20220518035006-a7e85ada93c5 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311132316-a219d84964c2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
dario.cat/mergo v1.0.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||
@ -45,9 +54,9 @@ require (
|
||||
github.com/fatih/structtag v1.2.0 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.4.1 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.0 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/gnostic v0.6.9 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
@ -59,7 +68,7 @@ require (
|
||||
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/vault/api v1.9.2 // indirect
|
||||
github.com/iancoleman/strcase v0.2.0 // indirect
|
||||
github.com/iancoleman/strcase v0.3.0 // indirect
|
||||
github.com/imdario/mergo v0.3.16 // indirect
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
|
||||
github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530 // indirect
|
||||
@ -77,6 +86,7 @@ require (
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/ncruces/go-strftime v0.1.9 // indirect
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
||||
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
@ -85,28 +95,27 @@ require (
|
||||
github.com/ryanuber/go-glob v1.0.0 // indirect
|
||||
github.com/sergi/go-diff v1.1.0 // indirect
|
||||
github.com/skeema/knownhosts v1.2.0 // indirect
|
||||
github.com/spf13/afero v1.3.3 // indirect
|
||||
github.com/spf13/afero v1.10.0 // indirect
|
||||
github.com/valyala/fastrand v1.1.0 // indirect
|
||||
github.com/valyala/histogram v1.2.0 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
go.uber.org/atomic v1.6.0 // indirect
|
||||
golang.org/x/crypto v0.12.0 // indirect
|
||||
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
|
||||
golang.org/x/net v0.14.0 // indirect
|
||||
golang.org/x/sys v0.11.0 // indirect
|
||||
golang.org/x/text v0.12.0 // indirect
|
||||
go.unistack.org/micro-config-file/v4 v4.0.3
|
||||
golang.org/x/crypto v0.19.0 // indirect
|
||||
golang.org/x/net v0.21.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
lukechampine.com/uint128 v1.3.0 // indirect
|
||||
modernc.org/cc/v3 v3.40.0 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.13 // indirect
|
||||
modernc.org/libc v1.22.3 // indirect
|
||||
modernc.org/mathutil v1.5.0 // indirect
|
||||
modernc.org/memory v1.5.0 // indirect
|
||||
modernc.org/cc/v3 v3.41.0 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.15 // indirect
|
||||
modernc.org/libc v1.41.0 // indirect
|
||||
modernc.org/mathutil v1.6.0 // indirect
|
||||
modernc.org/memory v1.7.2 // indirect
|
||||
modernc.org/opt v0.1.3 // indirect
|
||||
modernc.org/strutil v1.1.3 // indirect
|
||||
modernc.org/strutil v1.2.0 // indirect
|
||||
modernc.org/token v1.1.0 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
)
|
||||
|
122
go.sum
122
go.sum
@ -4,6 +4,7 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
||||
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||
cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
||||
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
||||
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
||||
@ -16,6 +17,7 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY
|
||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
||||
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
|
||||
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
|
||||
cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY=
|
||||
cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
|
||||
cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
|
||||
cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
|
||||
@ -41,6 +43,7 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo
|
||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
||||
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
|
||||
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
@ -295,6 +298,7 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
@ -352,8 +356,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
|
||||
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA=
|
||||
github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE=
|
||||
github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A=
|
||||
github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew=
|
||||
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
|
||||
@ -390,8 +394,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||
github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo=
|
||||
github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
|
||||
github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA=
|
||||
github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||
@ -495,8 +499,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
@ -518,7 +522,8 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-github/v35 v35.2.0/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
@ -536,6 +541,7 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
@ -547,11 +553,13 @@ github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
|
||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
|
||||
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
|
||||
@ -600,8 +608,8 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
|
||||
github.com/hashicorp/vault/api v1.9.2 h1:YjkZLJ7K3inKgMZ0wzCU9OHqc+UqMQyXsPXnf3Cl2as=
|
||||
github.com/hashicorp/vault/api v1.9.2/go.mod h1:jo5Y/ET+hNyz+JnKDt8XLAdKs+AM0G5W0Vp1IrFI8N8=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
|
||||
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
||||
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
|
||||
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
@ -612,6 +620,8 @@ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH
|
||||
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
|
||||
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
|
||||
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
|
||||
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
|
||||
@ -812,6 +822,8 @@ github.com/mutecomm/go-sqlcipher/v4 v4.4.0/go.mod h1:PyN04SaWalavxRGH9E8ZftG6Ju7
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
||||
github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA=
|
||||
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||
github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
|
||||
github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba/go.mod h1:ncO5VaFWh0Nrt+4KT4mOZboaczBZcLuHrG+/sUeP8gI=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
@ -876,7 +888,7 @@ github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
||||
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
@ -927,6 +939,7 @@ github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThC
|
||||
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
|
||||
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
|
||||
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
|
||||
@ -941,6 +954,8 @@ github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhr
|
||||
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
|
||||
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/silas/dag v0.0.0-20220518035006-a7e85ada93c5 h1:G/FZtUu7a6NTWl3KUHMV9jkLAh/Rvtf03NWMHaEDl+E=
|
||||
github.com/silas/dag v0.0.0-20220518035006-a7e85ada93c5/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
||||
github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
@ -960,17 +975,20 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
|
||||
github.com/spf13/afero v1.3.3 h1:p5gZEKLYoL7wh8VrJesMaYeNxdEd1v3cb4irOk9zB54=
|
||||
github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
|
||||
github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY=
|
||||
github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
|
||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
|
||||
github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8=
|
||||
@ -1072,8 +1090,8 @@ go.unistack.org/micro-codec-yaml/v4 v4.0.0 h1:DK/+fA69gmnvYmGHe3kqVR0pukS8ank5lP
|
||||
go.unistack.org/micro-codec-yaml/v4 v4.0.0/go.mod h1:UG4ouILbUfgNL7nvp7CpmD2IIzO8bQHjzDIahOvIAgM=
|
||||
go.unistack.org/micro-config-env/v4 v4.0.1 h1:A7W+Xm4WEsN9O6isWncfwNWEUuSuCHgt+aovpZ4XhuE=
|
||||
go.unistack.org/micro-config-env/v4 v4.0.1/go.mod h1:kJvyLrRbVRrsM1jTdl5lHy4u88PnlK2mskOZ3T57M/0=
|
||||
go.unistack.org/micro-config-file/v4 v4.0.1 h1:J8CNyOvxfL4CnoL2xocvyWHo77UWF8wvH4To23E0gOA=
|
||||
go.unistack.org/micro-config-file/v4 v4.0.1/go.mod h1:OSfm+CIjAgb0HRlXCZd0DUtDwV5zJKXMHduSiGsSY0M=
|
||||
go.unistack.org/micro-config-file/v4 v4.0.3 h1:1zUZWnzgf+iB8qbh6kOlA/iBUhDSByp2rKXwxn1yUFM=
|
||||
go.unistack.org/micro-config-file/v4 v4.0.3/go.mod h1:9MbYnGXnsrzvjxAPKutxCgxZxPYOUO/XBLW08aN8zD8=
|
||||
go.unistack.org/micro-config-vault/v4 v4.0.2 h1:QhDdtVJhQYmJZqAhsLRdnDZSZSzBunWX9a5l/WNKWNY=
|
||||
go.unistack.org/micro-config-vault/v4 v4.0.2/go.mod h1:0gWQVkncMwaG0wZPqC98HhS6AYOcXR0lmPG/roR6AcM=
|
||||
go.unistack.org/micro-logger-zerolog/v4 v4.0.3 h1:ao6jGMo8jJG9WcOE738eqrWeabQaqpHMrLx+IniRDpI=
|
||||
@ -1084,8 +1102,8 @@ go.unistack.org/micro-proto/v4 v4.0.1 h1:2RKHgtCOOcAFgKsnngGK5bqM/6MWXOjVCdw03db
|
||||
go.unistack.org/micro-proto/v4 v4.0.1/go.mod h1:ArmK7o+uFvxSY3dbJhKBBX4Pm1rhWdLEFf3LxBrMtec=
|
||||
go.unistack.org/micro-server-http/v4 v4.0.13 h1:/EUEE32ddsNH9qbBilg2cdnnMWXPOyL6TfG++Las4E4=
|
||||
go.unistack.org/micro-server-http/v4 v4.0.13/go.mod h1:mQ18qN/1PxeTCKMNslh5qgswV582DP9QnsaI/ohFo/k=
|
||||
go.unistack.org/micro/v4 v4.0.7 h1:2lwtZlHcSwgkahhFbkI4x1lOS79lw8uLHtcEhlFF+AM=
|
||||
go.unistack.org/micro/v4 v4.0.7/go.mod h1:bVEYTlPi0EsdgZZt311bIroDg9ict7ky3C87dSCCAGk=
|
||||
go.unistack.org/micro/v4 v4.0.18 h1:b7WFwem8Nz1xBrRg5FeLnm9CE5gJseHyf9j0BhkiXW0=
|
||||
go.unistack.org/micro/v4 v4.0.18/go.mod h1:5+da5r835gP0WnNZbYUJDCvWpJ9Xc3IEGyp62e8o8R4=
|
||||
go.unistack.org/protoc-gen-go-micro/v4 v4.0.7 h1:c3CeBvjWV9MBrGGPaQCcHZrnuLY9sVJHv7vACI/dvuM=
|
||||
go.unistack.org/protoc-gen-go-micro/v4 v4.0.7/go.mod h1:9bsKAlESlPXPBSmY/NDLL//smZbhnEMrnWyG+M8zVFA=
|
||||
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
@ -1109,15 +1127,17 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh
|
||||
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
|
||||
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
|
||||
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
@ -1167,8 +1187,8 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
|
||||
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@ -1230,8 +1250,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
|
||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
|
||||
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
@ -1261,8 +1281,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -1342,6 +1362,7 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@ -1349,6 +1370,7 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@ -1368,15 +1390,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
|
||||
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -1389,8 +1411,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
|
||||
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@ -1463,6 +1485,7 @@ golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4f
|
||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
@ -1471,8 +1494,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8=
|
||||
golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8=
|
||||
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
|
||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
||||
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@ -1559,8 +1582,10 @@ google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6D
|
||||
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210207032614-bba0dbe2a9ea/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
@ -1577,7 +1602,8 @@ google.golang.org/genproto v0.0.0-20210721163202-f1cecdd8b78a/go.mod h1:ob2IJxKr
|
||||
google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
|
||||
google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311132316-a219d84964c2 h1:9IZDv+/GcI6u+a4jRFRLxQs0RUCfavGfoOgEW6jpkI0=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311132316-a219d84964c2/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs=
|
||||
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
@ -1607,7 +1633,7 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ
|
||||
google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
|
||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
|
||||
google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag=
|
||||
google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk=
|
||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
@ -1622,8 +1648,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
@ -1703,11 +1729,11 @@ lukechampine.com/uint128 v1.3.0 h1:cDdUVfRwDUDovz610ABgFD17nXD4/uDgVHl2sC3+sbo=
|
||||
lukechampine.com/uint128 v1.3.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
|
||||
modernc.org/b v1.0.0/go.mod h1:uZWcZfRj1BpYzfN9JTerzlNUnnPsV9O2ZA8JsRcubNg=
|
||||
modernc.org/cc/v3 v3.32.4/go.mod h1:0R6jl1aZlIl2avnYfbfHBS1QB6/f+16mihBObaBC878=
|
||||
modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw=
|
||||
modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0=
|
||||
modernc.org/cc/v3 v3.41.0 h1:QoR1Sn3YWlmA1T4vLaKZfawdVtSiGx8H+cEojbC7v1Q=
|
||||
modernc.org/cc/v3 v3.41.0/go.mod h1:Ni4zjJYJ04CDOhG7dn640WGfwBzfE0ecX8TyMB0Fv0Y=
|
||||
modernc.org/ccgo/v3 v3.9.2/go.mod h1:gnJpy6NIVqkETT+L5zPsQFj7L2kkhfPMzOghRNv/CFo=
|
||||
modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw=
|
||||
modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY=
|
||||
modernc.org/ccgo/v3 v3.16.15 h1:KbDR3ZAVU+wiLyMESPtbtE/Add4elztFyfsWoNTgxS0=
|
||||
modernc.org/ccgo/v3 v3.16.15/go.mod h1:yT7B+/E2m43tmMOT51GMoM98/MtHIcQQSleGnddkUNI=
|
||||
modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk=
|
||||
modernc.org/db v1.0.0/go.mod h1:kYD/cO29L/29RM0hXYl4i3+Q5VojL31kTUVpVJDw0s8=
|
||||
modernc.org/file v1.0.0/go.mod h1:uqEokAEn1u6e+J45e54dsEA/pw4o7zLrA2GwyntZzjw=
|
||||
@ -1718,17 +1744,17 @@ modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM=
|
||||
modernc.org/internal v1.0.0/go.mod h1:VUD/+JAkhCpvkUitlEOnhpVxCgsBI90oTzSCRcqQVSM=
|
||||
modernc.org/libc v1.7.13-0.20210308123627-12f642a52bb8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
|
||||
modernc.org/libc v1.9.5/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
|
||||
modernc.org/libc v1.22.3 h1:D/g6O5ftAfavceqlLOFwaZuA5KYafKwmr30A6iSqoyY=
|
||||
modernc.org/libc v1.22.3/go.mod h1:MQrloYP209xa2zHome2a8HLiLm6k0UT8CoHpV74tOFw=
|
||||
modernc.org/libc v1.41.0 h1:g9YAc6BkKlgORsUWj+JwqoB1wU3o4DE3bM3yvA3k+Gk=
|
||||
modernc.org/libc v1.41.0/go.mod h1:w0eszPsiXoOnoMJgrXjglgLuDy/bt5RR4y3QzUUeodY=
|
||||
modernc.org/lldb v1.0.0/go.mod h1:jcRvJGWfCGodDZz8BPwiKMJxGJngQ/5DrRapkQnLob8=
|
||||
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
|
||||
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ=
|
||||
modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
|
||||
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
|
||||
modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc=
|
||||
modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds=
|
||||
modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
|
||||
modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E=
|
||||
modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E=
|
||||
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
|
||||
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||
@ -1738,8 +1764,8 @@ modernc.org/sqlite v1.10.6/go.mod h1:Z9FEjUtZP4qFEg6/SiADg9XCER7aYy9a/j7Pg9P7CPs
|
||||
modernc.org/sqlite v1.21.0 h1:4aP4MdUf15i3R3M2mx6Q90WHKz3nZLoz96zlB6tNdow=
|
||||
modernc.org/sqlite v1.21.0/go.mod h1:XwQ0wZPIh1iKb5mkvCJ3szzbhk+tykC8ZWqTRTgYRwI=
|
||||
modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
|
||||
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
|
||||
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
|
||||
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
|
||||
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
|
||||
modernc.org/tcl v1.5.2/go.mod h1:pmJYOLgpiys3oI4AeAafkcUfE+TKKilminxNyU/+Zlo=
|
||||
modernc.org/tcl v1.15.1 h1:mOQwiEK4p7HruMZcwKTZPw/aqtGM4aY00uzWhlKKYws=
|
||||
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||
|
94
internal/cli/checkupdate.go
Normal file
94
internal/cli/checkupdate.go
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
|
||||
*/
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/modules"
|
||||
"github.com/spf13/cobra"
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
"golang.org/x/mod/modfile"
|
||||
"golang.org/x/mod/semver"
|
||||
)
|
||||
|
||||
// checkupdateCmd represents the checkupdate command
|
||||
var checkupdateCmd = NewCheckUpdateCommand()
|
||||
|
||||
var mvs = make(map[string]modules.Update)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(checkupdateCmd)
|
||||
}
|
||||
|
||||
func NewCheckUpdateCommand() *cobra.Command {
|
||||
ctx := context.Background()
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "checkupdate",
|
||||
Short: "CheckUpdate collects a list of dependencies with the latest updates.",
|
||||
Long: `CheckUpdate collects a list of dependencies with the latest updates.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println("checkupdate called")
|
||||
path := "."
|
||||
if len(os.Args) > 1 {
|
||||
path = os.Args[1]
|
||||
}
|
||||
|
||||
name, err := modules.FindModFile(path)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
buf, err := os.ReadFile(name)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
mfile, err := modfile.Parse(name, buf, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
mvs = make(map[string]modules.Update)
|
||||
|
||||
updateOptions := modules.UpdateOptions{
|
||||
Pre: cfg.UpdateOpt.Pre,
|
||||
Major: cfg.UpdateOpt.Major,
|
||||
UpMajor: cfg.UpdateOpt.UpMajor,
|
||||
Cached: cfg.UpdateOpt.Cached,
|
||||
OnUpdate: func(u modules.Update) {
|
||||
var modpath string // new mod path with major
|
||||
if u.Err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("%s: failed: %v", u.Module.Path, u.Err))
|
||||
return
|
||||
}
|
||||
modpath = u.Module.Path
|
||||
v := semver.Major(u.Version)
|
||||
p := modules.ModPrefix(modpath)
|
||||
if !strings.HasPrefix(u.Module.Version, v) && v != "v1" && v != "v0" {
|
||||
switch strings.HasPrefix(u.Module.Path, "gopkg.in") {
|
||||
case true:
|
||||
modpath = p + "." + v
|
||||
case false:
|
||||
modpath = p + "/" + v
|
||||
}
|
||||
}
|
||||
mvs[modpath] = u
|
||||
},
|
||||
}
|
||||
|
||||
for _, req := range mfile.Require {
|
||||
updateOptions.Modules = append(updateOptions.Modules, req.Mod)
|
||||
}
|
||||
|
||||
modules.Updates(updateOptions)
|
||||
logger.Info(ctx, fmt.Sprintf("Modules get update: /n %s", mvs))
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
74
internal/cli/delete.go
Normal file
74
internal/cli/delete.go
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
|
||||
*/
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var deleteCmd = NewDeleteCommand()
|
||||
|
||||
type DeleteFlags struct {
|
||||
all bool
|
||||
mod string
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(deleteCmd)
|
||||
}
|
||||
|
||||
func NewDeleteCommand() *cobra.Command {
|
||||
var flags DeleteFlags
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "delete",
|
||||
Short: "Delete closes the merge requests created with a dependency update.",
|
||||
Long: `Delete closes the merge requests created with a dependency update.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println("delete called")
|
||||
var err error
|
||||
|
||||
if gitsource == nil {
|
||||
return errSourceNil
|
||||
}
|
||||
|
||||
if len(prList) == 0 {
|
||||
return errPRNotExist
|
||||
}
|
||||
|
||||
if flags.all {
|
||||
for _, branch := range cfg.Branches {
|
||||
rMap := prList[branch]
|
||||
for path, _ := range rMap {
|
||||
err = gitsource.RequestClose(ctx, branch, path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if flags.mod != "" {
|
||||
for _, branch := range cfg.Branches {
|
||||
err = gitsource.RequestClose(ctx, branch, flags.mod)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errFlagsNotExist
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().BoolVarP(&flags.all, "all", "a", false, "Deletes everything depending")
|
||||
cmd.Flags().StringVarP(&flags.mod, "mod", "m", "", "Deletes one dependency")
|
||||
|
||||
return cmd
|
||||
}
|
121
internal/cli/init.go
Normal file
121
internal/cli/init.go
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
|
||||
*/
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/configcli"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/source"
|
||||
"github.com/spf13/cobra"
|
||||
yamlcodec "go.unistack.org/micro-codec-yaml/v4"
|
||||
envconfig "go.unistack.org/micro-config-env/v4"
|
||||
fileconfig "go.unistack.org/micro-config-file/v4"
|
||||
"go.unistack.org/micro/v4/config"
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
"go.unistack.org/micro/v4/logger/slog"
|
||||
"go.unistack.org/micro/v4/options"
|
||||
)
|
||||
|
||||
// initCmd represents the init command
|
||||
var initCmd = NewInitCommand()
|
||||
|
||||
var gitsource = source.SourceControl(nil)
|
||||
|
||||
var cfg = configcli.NewConfig()
|
||||
|
||||
var (
|
||||
DefaultPullRequestTitle = `Bump {{.Name}} from {{.VersionOld}} to {{.VersionNew}}`
|
||||
DefaultPullRequestBody = `Bumps {{.Name}} from {{.VersionOld}} to {{.VersionNew}}`
|
||||
)
|
||||
|
||||
var (
|
||||
configFiles = []string{
|
||||
"dependabot.yml",
|
||||
"pkgdashcli.yml",
|
||||
"pkgdashcli.yaml",
|
||||
}
|
||||
configDirs = []string{
|
||||
".gitea",
|
||||
".github",
|
||||
".gitlab",
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(initCmd)
|
||||
}
|
||||
|
||||
func NewInitCommand() *cobra.Command {
|
||||
ctx := context.Background()
|
||||
|
||||
logger.DefaultLogger = slog.NewLogger()
|
||||
|
||||
if err := logger.DefaultLogger.Init(logger.WithCallerSkipCount(3), logger.WithLevel(logger.DebugLevel)); err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("logger init error: %v", err))
|
||||
}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "init",
|
||||
Short: "Init fills the config with data from the configuration file.",
|
||||
Long: `Init fills the config with data from the configuration file.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println("init called")
|
||||
var err error
|
||||
|
||||
if err = config.Load(ctx,
|
||||
[]config.Config{
|
||||
config.NewConfig(
|
||||
config.Struct(cfg),
|
||||
),
|
||||
envconfig.NewConfig(
|
||||
config.Struct(cfg),
|
||||
),
|
||||
},
|
||||
config.LoadOverride(true),
|
||||
); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to load config: %v", err))
|
||||
}
|
||||
|
||||
for _, configDir := range configDirs {
|
||||
for _, configFile := range configFiles {
|
||||
logger.Info(ctx, fmt.Sprintf("path: %s", filepath.Join(configDir, configFile)))
|
||||
c := fileconfig.NewConfig(
|
||||
config.AllowFail(false),
|
||||
config.Struct(cfg),
|
||||
options.Codec(yamlcodec.NewCodec()),
|
||||
fileconfig.Path(".gitea/pkgdashcli.yaml"),
|
||||
)
|
||||
err = c.Init(options.Context(ctx))
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to init config: %v", err))
|
||||
return err
|
||||
}
|
||||
if err = c.Load(ctx, config.LoadOverride(true)); err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to load config: %v", err))
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("Load config... %s", cfg.Source.Repository))
|
||||
|
||||
if cfg.PullRequestBody == "" {
|
||||
cfg.PullRequestBody = DefaultPullRequestBody
|
||||
}
|
||||
|
||||
if cfg.PullRequestTitle == "" {
|
||||
cfg.PullRequestTitle = DefaultPullRequestTitle
|
||||
}
|
||||
|
||||
gitsource = source.NewSourceControl(*cfg)
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
73
internal/cli/list.go
Normal file
73
internal/cli/list.go
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
|
||||
*/
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
// updateCmd represents the update command
|
||||
var listCmd = NewListCommand()
|
||||
|
||||
var prList = map[string]map[string]string{}
|
||||
|
||||
/* [
|
||||
"master":
|
||||
[
|
||||
"go.unistack.org/micro/v4" : "Bump go.unistack.org/micro/v4 from v4.0.0 to v4.0.1",
|
||||
"go.unistack.org/micro-client-http/v4":"Bump go.unistack.org/micro-client-http/v4 from v4.0.0 to v4.0.2",
|
||||
],
|
||||
"v3":
|
||||
[
|
||||
"go.unistack.org/micro/v3" : "Bump go.unistack.org/micro/v4 from v3.0.0 to v3.0.1",
|
||||
],
|
||||
] */
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(listCmd)
|
||||
}
|
||||
|
||||
func NewListCommand() *cobra.Command {
|
||||
ctx := context.Background()
|
||||
|
||||
logger.Info(ctx, "RequestList start")
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "Update allows you to start the process of creating a PR in the repository",
|
||||
Long: `
|
||||
Update allows you to start the process of creating a PR in the repository.
|
||||
Use the -a flag to update all dependencies or -m flag a specific module.
|
||||
`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if gitsource == nil {
|
||||
return errSourceNil
|
||||
}
|
||||
|
||||
if cfg == nil {
|
||||
return errCfgNil
|
||||
}
|
||||
|
||||
prList = make(map[string]map[string]string)
|
||||
|
||||
for _, branch := range cfg.Branches {
|
||||
rMap, err := gitsource.RequestList(ctx, branch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
prList[branch] = rMap
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("for %s:\n%s", branch, rMap))
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
42
internal/cli/root.go
Normal file
42
internal/cli/root.go
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
|
||||
*/
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
errUpdateNotExist = fmt.Errorf("mod not in list of update. Call init")
|
||||
errFlagsNotExist = fmt.Errorf("empty flags")
|
||||
errSourceNil = fmt.Errorf("source nil. Call init")
|
||||
errCfgNil = fmt.Errorf("cfg nil. Call init")
|
||||
errPRNotExist = fmt.Errorf("pr not exist. Call list")
|
||||
)
|
||||
|
||||
// rootCmd represents the base command when called without any subcommands
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "pkgdashcli <command> [flags]",
|
||||
Short: "Pkgdashcli application to update dependencies.",
|
||||
Long: `Pkgdashcli allows you to define a version update for a dependency and start merge requests in version control systems.`,
|
||||
// Uncomment the following line if your bare application
|
||||
// has an action associated with it:
|
||||
// Run: func(cmd *cobra.Command, args []string) { },
|
||||
}
|
||||
|
||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
||||
// This is called by main.main(). It only needs to happen once to the rootCmd.
|
||||
func Execute() {
|
||||
err := rootCmd.Execute()
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
}
|
95
internal/cli/update.go
Normal file
95
internal/cli/update.go
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
|
||||
*/
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
var updateCmd = NewUpdateCommand()
|
||||
|
||||
type UpdateFlags struct {
|
||||
all bool
|
||||
mod string
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(updateCmd)
|
||||
}
|
||||
|
||||
func NewUpdateCommand() *cobra.Command {
|
||||
var flags UpdateFlags
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "update",
|
||||
Short: "Update allows you to start the process of creating a PR in the repository",
|
||||
Long: `
|
||||
Update allows you to start the process of creating a PR in the repository.
|
||||
Use the -a flag to update all dependencies or -m flag a specific module.
|
||||
`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
var err error
|
||||
|
||||
if gitsource == nil {
|
||||
return errSourceNil
|
||||
}
|
||||
if len(mvs) == 0 {
|
||||
return errUpdateNotExist
|
||||
}
|
||||
|
||||
if flags.all {
|
||||
logger.Info(ctx, "update all")
|
||||
for pathMod, m := range mvs {
|
||||
for _, branch := range cfg.Branches {
|
||||
logger.Info(ctx, fmt.Sprintf("update mod: %s", m))
|
||||
|
||||
if err = gitsource.RequestOpen(ctx, branch, pathMod, m); err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("PR open error: %s, base branch: %s", pathMod, branch))
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("Successful update mod: %s", pathMod))
|
||||
}
|
||||
|
||||
delete(mvs, pathMod) // todo возможно чисть не стоит и нужно просто пропускать
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if flags.mod != "" {
|
||||
for _, branch := range cfg.Branches {
|
||||
logger.Info(ctx, fmt.Sprintf("update mod: %s", flags.mod))
|
||||
|
||||
if _, ok := mvs[flags.mod]; !ok {
|
||||
return errUpdateNotExist
|
||||
}
|
||||
|
||||
if err = gitsource.RequestOpen(ctx, branch, flags.mod, mvs[flags.mod]); err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("PR open error: %s, base branch: %s", flags.mod, branch))
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("Successful update mod: %s", flags.mod))
|
||||
}
|
||||
|
||||
delete(mvs, flags.mod)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
return errFlagsNotExist
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().BoolVarP(&flags.all, "all", "a", false, "Updates everything depending")
|
||||
cmd.Flags().StringVarP(&flags.mod, "mod", "m", "", "Update one dependency")
|
||||
|
||||
return cmd
|
||||
}
|
30
internal/configcli/config.go
Normal file
30
internal/configcli/config.go
Normal file
@ -0,0 +1,30 @@
|
||||
package configcli
|
||||
|
||||
type Config struct {
|
||||
PullRequestTitle string `json:"pull_request_title" yaml:"pull_request_title"`
|
||||
PullRequestBody string `json:"pull_request_body" yaml:"pull_request_body"`
|
||||
Branches []string `json:"branches" yaml:"branches"`
|
||||
Source *Source `json:"source" yaml:"source"`
|
||||
UpdateOpt *UpdateOpt `json:"update_opt" yaml:"update_opt"`
|
||||
}
|
||||
|
||||
type Source struct {
|
||||
TypeGit string `json:"type" yaml:"type"`
|
||||
Token string `json:"token" yaml:"token"`
|
||||
APIURL string `json:"apiurl" yaml:"apiurl"`
|
||||
Repository string `json:"repository" yaml:"repository"`
|
||||
Owner string `json:"owner" yaml:"owner"`
|
||||
}
|
||||
|
||||
type UpdateOpt struct {
|
||||
Pre bool `json:"pre" yaml:"pre" default:"false"`
|
||||
Major bool `json:"major" yaml:"major" default:"false"`
|
||||
UpMajor bool `json:"up_major" yaml:"up_major" default:"false"`
|
||||
Cached bool `json:"cached" yaml:"cached" default:"true"`
|
||||
}
|
||||
|
||||
func NewConfig() *Config {
|
||||
return &Config{
|
||||
Source: &Source{},
|
||||
}
|
||||
}
|
@ -80,7 +80,7 @@ func ParseDSN(cfg *appconfig.DatabaseConfig) error {
|
||||
case "sqlite", "sqlite3":
|
||||
u.Scheme = "sqlite"
|
||||
default:
|
||||
return fmt.Errorf("unknown database %s", u.Scheme)
|
||||
return fmt.Error("unknown database %s", u.Scheme)
|
||||
}
|
||||
|
||||
cfg.Type = u.Scheme
|
||||
@ -95,7 +95,7 @@ func connect(ctx context.Context, cfg *appconfig.DatabaseConfig, log logger.Logg
|
||||
var db *sqlx.DB
|
||||
var err error
|
||||
|
||||
log.Infof(ctx, "connect to %s", cfg.Type)
|
||||
log.Info(ctx, "connect to %s", cfg.Type)
|
||||
switch cfg.Type {
|
||||
case "postgres", "pgsql", "postgresql":
|
||||
db, err = connectPostgres(ctx, cfg.ConnStr)
|
||||
@ -104,7 +104,7 @@ func connect(ctx context.Context, cfg *appconfig.DatabaseConfig, log logger.Logg
|
||||
db, err = connectSqlite(ctx, cfg.ConnStr)
|
||||
cfg.Type = "sqlite"
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown database type %s", cfg.Type)
|
||||
return nil, fmt.Error("unknown database type %s", cfg.Type)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
@ -128,18 +128,18 @@ func Connect(ctx context.Context, cfg *appconfig.DatabaseConfig, log logger.Logg
|
||||
case "":
|
||||
break
|
||||
case "up":
|
||||
logger.Infof(ctx, "migrate up")
|
||||
logger.Info(ctx, "migrate up")
|
||||
err = m.Up()
|
||||
case "down":
|
||||
logger.Infof(ctx, "migrate down")
|
||||
logger.Info(ctx, "migrate down")
|
||||
err = m.Down()
|
||||
case "seed":
|
||||
logger.Infof(ctx, "migrate seed")
|
||||
logger.Info(ctx, "migrate seed")
|
||||
if err = m.Drop(); err == nil {
|
||||
err = m.Up()
|
||||
}
|
||||
default:
|
||||
logger.Infof(ctx, "migrate version")
|
||||
logger.Info(ctx, "migrate version")
|
||||
v, verr := strconv.ParseUint(cfg.Type, 10, 64)
|
||||
if verr != nil {
|
||||
return nil, err
|
||||
@ -249,5 +249,5 @@ func (l *mLog) Verbose() bool {
|
||||
}
|
||||
|
||||
func (l *mLog) Printf(format string, v ...interface{}) {
|
||||
l.l.Infof(l.ctx, format, v...)
|
||||
l.l.Info(l.ctx, format, v...)
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ func (h *Handler) HandlerList(ctx context.Context, req *pb.HandlerListReq, rsp *
|
||||
|
||||
packages, err := h.store.HandlerList(ctx, req)
|
||||
if err != nil {
|
||||
logger.Errorf(ctx, "error db response: %v", err)
|
||||
logger.Error(ctx, "error db response: %v", err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
||||
return httpsrv.SetError(NewInternalError(err))
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ func (h *Handler) PackageList(ctx context.Context, req *pb.PackageListReq, rsp *
|
||||
|
||||
packages, err := h.store.PackageList(ctx, req)
|
||||
if err != nil {
|
||||
logger.Errorf(ctx, "error db response: %v", err)
|
||||
logger.Error(ctx, "error db response: %v", err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
||||
return httpsrv.SetError(NewInternalError(err))
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ func (h *Handler) PackageModules(ctx context.Context, req *pb.PackageModulesReq,
|
||||
|
||||
modules, err := h.store.PackageModules(ctx, req)
|
||||
if err != nil {
|
||||
logger.Errorf(ctx, "error db response: %v", err)
|
||||
logger.Error(ctx, "error db response: %v", err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
||||
return httpsrv.SetError(NewInternalError(err))
|
||||
}
|
||||
|
@ -249,7 +249,8 @@ type UpdateOptions struct {
|
||||
Modules []module.Version
|
||||
Pre bool
|
||||
Cached bool
|
||||
Major bool
|
||||
Major bool // Major true compare only major
|
||||
UpMajor bool // UpMajor module up with major
|
||||
}
|
||||
|
||||
// Updates finds updates for a set of specified modules.
|
||||
@ -275,7 +276,14 @@ func Updates(opt UpdateOptions) {
|
||||
ch <- Update{Module: m, Err: err}
|
||||
return nil
|
||||
}
|
||||
v := mod.MaxVersion("", opt.Pre)
|
||||
major := semver.Major(m.Version)
|
||||
var v string
|
||||
switch opt.UpMajor {
|
||||
case true:
|
||||
v = mod.MaxVersion("", opt.Pre)
|
||||
case false:
|
||||
v = mod.MaxVersion(major, opt.Pre)
|
||||
}
|
||||
if IsNewerVersion(m.Version, v, opt.Major) {
|
||||
ch <- Update{Module: m, Version: v}
|
||||
}
|
||||
|
55
internal/modules/packages_test.go
Normal file
55
internal/modules/packages_test.go
Normal file
@ -0,0 +1,55 @@
|
||||
package modules
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestModMajor(t *testing.T) {
|
||||
type args struct {
|
||||
modpath string
|
||||
}
|
||||
var tests = []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
want1 bool
|
||||
}{
|
||||
{"Test #1",
|
||||
args{
|
||||
"github.com/jackc/chunkreader/v2",
|
||||
},
|
||||
"v2",
|
||||
true,
|
||||
},
|
||||
{"Test #2",
|
||||
args{
|
||||
"github.com/jackc/chunkreader",
|
||||
},
|
||||
"",
|
||||
true,
|
||||
},
|
||||
{"Test #3",
|
||||
args{
|
||||
"gopkg.in/yaml.v2",
|
||||
},
|
||||
"v2",
|
||||
true,
|
||||
},
|
||||
{"Test #4",
|
||||
args{
|
||||
"github.com/jackc/chunkreader/v1",
|
||||
},
|
||||
"",
|
||||
false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, got1 := ModMajor(tt.args.modpath)
|
||||
if got != tt.want {
|
||||
t.Error("ModMajor() got = %v, want %v", got, tt.want)
|
||||
}
|
||||
if got1 != tt.want1 {
|
||||
t.Error("ModMajor() got1 = %v, want %v", got1, tt.want1)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
438
internal/source/gitea/gitea.go
Normal file
438
internal/source/gitea/gitea.go
Normal file
@ -0,0 +1,438 @@
|
||||
package gitea
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/configcli"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/modules"
|
||||
"github.com/go-git/go-git/v5"
|
||||
gitconfig "github.com/go-git/go-git/v5/config"
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
"github.com/go-git/go-git/v5/plumbing/object"
|
||||
httpauth "github.com/go-git/go-git/v5/plumbing/transport/http"
|
||||
"go.unistack.org/micro/v4/logger"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrPRNotExist = errors.New("pull request does not exist")
|
||||
)
|
||||
|
||||
type Gitea struct {
|
||||
URL string
|
||||
Token string
|
||||
PRTitle string
|
||||
PRBody string
|
||||
Repository string
|
||||
Owner string
|
||||
}
|
||||
|
||||
func NewGitea(cfg configcli.Config) *Gitea {
|
||||
return &Gitea{
|
||||
URL: cfg.Source.APIURL,
|
||||
Token: os.Getenv("gitea_token"),
|
||||
PRTitle: cfg.PullRequestTitle,
|
||||
PRBody: cfg.PullRequestBody,
|
||||
Repository: cfg.Source.Repository,
|
||||
Owner: cfg.Source.Owner,
|
||||
}
|
||||
}
|
||||
|
||||
type giteaPull struct {
|
||||
URL string `json:"url"`
|
||||
Title string `json:"title"`
|
||||
Base struct {
|
||||
Ref string `json:"ref"`
|
||||
} `json:"base"`
|
||||
Head struct {
|
||||
Ref string `json:"ref"`
|
||||
} `json:"head"`
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
logger.Debugf(ctx, fmt.Sprintf("RequestOpen start, mod title: %s", path))
|
||||
|
||||
var buf []byte
|
||||
var err error
|
||||
// создания шаблона названия для пулл реквеста
|
||||
tplTitle, err := template.New("pull_request_title").Parse(g.PRTitle)
|
||||
if err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to parse template: %v", err))
|
||||
}
|
||||
|
||||
wTitle := bytes.NewBuffer(nil)
|
||||
// создания шаблона тела для пулл реквеста
|
||||
tplBody, err := template.New("pull_request_body").Parse(g.PRTitle)
|
||||
if err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to parse template: %v", err))
|
||||
}
|
||||
|
||||
wBody := bytes.NewBuffer(nil)
|
||||
|
||||
data := map[string]string{
|
||||
"Name": path,
|
||||
"VersionOld": mod.Module.Version,
|
||||
"VersionNew": mod.Version,
|
||||
}
|
||||
|
||||
if err = tplTitle.Execute(wTitle, data); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to execute template: %v", err))
|
||||
}
|
||||
if err = tplBody.Execute(wBody, data); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to execute template: %v", err))
|
||||
}
|
||||
|
||||
// открытие гит репозитория с опцией обхода репозитория для нахождения .git
|
||||
repo, err := git.PlainOpenWithOptions(".", &git.PlainOpenOptions{DetectDotGit: true})
|
||||
if err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to open repo: %v", err))
|
||||
}
|
||||
//извлекаем ссылки с объектами из удаленного объекта??
|
||||
if err = repo.FetchContext(ctx, &git.FetchOptions{
|
||||
Auth: &httpauth.BasicAuth{Username: g.Token, Password: g.Token},
|
||||
Force: true,
|
||||
}); err != nil && err != git.NoErrAlreadyUpToDate {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to fetch repo: %v", err))
|
||||
} //обновляем репозиторий
|
||||
|
||||
var headRef *plumbing.Reference // вроде ссылка на гит
|
||||
refIter, err := repo.Branches() //получение веток
|
||||
if err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to get branches: %v", err))
|
||||
return err
|
||||
}
|
||||
for {
|
||||
ref, err := refIter.Next()
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
if strings.Contains(ref.Name().String(), branch) { //todo вот тут возможно нужно переделать
|
||||
headRef = ref
|
||||
break
|
||||
}
|
||||
} //перебираем получение ветки и когда находим нужную выходим из цикла записав ветку в headRef
|
||||
refIter.Close()
|
||||
|
||||
if headRef == nil {
|
||||
logger.Fatal(ctx, "failed to get repo branch head")
|
||||
return err
|
||||
} // Не получили нужную ветку
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("repo head %s", headRef))
|
||||
|
||||
wtree, err := repo.Worktree() //todo вроде рабочее дерево не нужно
|
||||
if err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to get worktree: %v", err))
|
||||
}
|
||||
|
||||
pulls, err := GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Token)
|
||||
if err != nil && err != ErrPRNotExist {
|
||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||
return err
|
||||
}
|
||||
|
||||
for _, pull := range pulls {
|
||||
logger.Debugf(ctx, fmt.Sprintf("PULL title - %s | ref - %s", pull.Title, pull.Base.Ref))
|
||||
if strings.Contains(pull.Title, path) && strings.Contains(pull.Base.Ref, branch) {
|
||||
logger.Info(ctx, fmt.Sprintf("PR for %s exists %s, call RequestUpdate", path, pull.URL))
|
||||
return g.RequestUpdate(ctx, branch, path, mod)
|
||||
} // хотим проверить есть ли пулл реквест для этой ветки, если есть то выходим
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("update %s from %s to %s", path, mod.Module.Version, mod.Version))
|
||||
|
||||
logger.Info(ctx, "reset worktree")
|
||||
if err = wtree.Reset(&git.ResetOptions{Mode: git.HardReset}); err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to reset repo branch: %v", err))
|
||||
} //вроде меняем ветку todo вроде можно удалить
|
||||
|
||||
if err = wtree.PullContext(ctx, &git.PullOptions{
|
||||
Auth: &httpauth.BasicAuth{Username: g.Token, Password: g.Token},
|
||||
Depth: 1,
|
||||
// RemoteURL :
|
||||
Force: true,
|
||||
RemoteName: "origin",
|
||||
}); err != nil && err != git.NoErrAlreadyUpToDate {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to pull repo: %v", err)) //подтягиваем изменения с удаленого репозитория
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("checkout ref %s", headRef))
|
||||
if err = wtree.Checkout(&git.CheckoutOptions{
|
||||
Hash: headRef.Hash(),
|
||||
Branch: plumbing.NewBranchReferenceName(fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version)),
|
||||
Create: true,
|
||||
Force: true,
|
||||
}); err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to checkout tree: %v", err))
|
||||
return err
|
||||
} //создаем новую ветку
|
||||
|
||||
epath, err := exec.LookPath("go")
|
||||
if errors.Is(err, exec.ErrDot) {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to find go command: %v", err))
|
||||
} // ищем go файл
|
||||
|
||||
var cmd *exec.Cmd
|
||||
var out []byte
|
||||
|
||||
cmd = exec.CommandContext(ctx, epath, "mod", "edit", fmt.Sprintf("-droprequire=%s", mod.Module.Path))
|
||||
if out, err = cmd.CombinedOutput(); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to run go mod edit: %s err: %v", out, err))
|
||||
}
|
||||
|
||||
cmd = exec.CommandContext(ctx, epath, "mod", "edit", fmt.Sprintf("-require=%s@%s", path, mod.Version))
|
||||
if out, err = cmd.CombinedOutput(); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to run go mod edit: %s err: %v", out, err))
|
||||
} // пытаемся выполнить команду go mod edit с новой версией модуля
|
||||
|
||||
cmd = exec.CommandContext(ctx, epath, "mod", "tidy")
|
||||
if out, err = cmd.CombinedOutput(); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to run go mod tidy: %s err: %v", out, err))
|
||||
} // пытаемся выполнить команду go mod tidy пытаемся подтянуть новую версию модуля
|
||||
|
||||
logger.Info(ctx, "worktree add go.mod")
|
||||
if _, err = wtree.Add("go.mod"); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to add file: %v", err))
|
||||
}
|
||||
|
||||
logger.Info(ctx, "worktree add go.sum")
|
||||
if _, err = wtree.Add("go.sum"); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to add file: %v", err))
|
||||
}
|
||||
|
||||
logger.Info(ctx, "worktree commit")
|
||||
_, err = wtree.Commit(wTitle.String(), &git.CommitOptions{
|
||||
Parents: []plumbing.Hash{headRef.Hash()},
|
||||
Author: &object.Signature{
|
||||
Name: "gitea-actions",
|
||||
Email: "info@unistack.org",
|
||||
When: time.Now(),
|
||||
},
|
||||
}) // хотим за коммитить изменения
|
||||
if err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to commit: %v", err))
|
||||
}
|
||||
|
||||
refspec := gitconfig.RefSpec(fmt.Sprintf("+refs/heads/pkgdash/go_modules/%s-%s:refs/heads/pkgdash/go_modules/%s-%s", path, mod.Version, path, mod.Version)) //todo как будто нужно переделать
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("try to push refspec %s", refspec))
|
||||
|
||||
if err = repo.PushContext(ctx, &git.PushOptions{
|
||||
RefSpecs: []gitconfig.RefSpec{refspec},
|
||||
Auth: &httpauth.BasicAuth{Username: g.Token, Password: g.Token},
|
||||
Force: true,
|
||||
}); err != nil {
|
||||
logger.Fatal(ctx, fmt.Sprintf("failed to push repo branch: %v", err))
|
||||
} // пытаемся за пушить изменения
|
||||
|
||||
body := map[string]string{
|
||||
"base": branch,
|
||||
"body": wBody.String(),
|
||||
"head": fmt.Sprintf("pkgdash/go_modules/%s-%s", path, mod.Version),
|
||||
"title": wTitle.String(),
|
||||
}
|
||||
logger.Info(ctx, fmt.Sprintf("raw body: %#+v", body))
|
||||
|
||||
buf, err = json.Marshal(body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("marshal body: %s", buf))
|
||||
|
||||
req, err := http.NewRequestWithContext(
|
||||
ctx,
|
||||
http.MethodPost,
|
||||
fmt.Sprintf("%s/repos/%s/%s/pulls?token=%s", g.URL, g.Owner, g.Repository, g.Token),
|
||||
bytes.NewReader(buf),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
|
||||
rsp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
} //Вроде создаем новый реквест на создание пулл реквеста
|
||||
if rsp.StatusCode != http.StatusCreated {
|
||||
buf, _ = io.ReadAll(rsp.Body)
|
||||
return fmt.Errorf("unknown error: %s", buf)
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("PR create for %s-%s", path, mod.Version))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *Gitea) RequestClose(ctx context.Context, branch string, path string) error {
|
||||
logger.Debugf(ctx, fmt.Sprintf("RequestClose start, mod title: %s", path))
|
||||
|
||||
pulls, err := GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Token)
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||
return err
|
||||
}
|
||||
|
||||
prExist := false
|
||||
var b string // Name of the branch to be deleted
|
||||
for _, pull := range pulls {
|
||||
if strings.Contains(pull.Title, path) && pull.Base.Ref == branch {
|
||||
logger.Info(ctx, fmt.Sprintf("PR for %s exists: %s", path, pull.URL))
|
||||
prExist = true
|
||||
b = pull.Head.Ref
|
||||
}
|
||||
}
|
||||
if !prExist {
|
||||
logger.Error(ctx, fmt.Sprintf("skip %s since pr does not exist", path))
|
||||
return ErrPRNotExist
|
||||
}
|
||||
|
||||
req, err := DeleteBranch(ctx, g.URL, g.Owner, g.Repository, b, g.Token)
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to create request for delete the branch: %s, err: %s", branch, err))
|
||||
return err
|
||||
}
|
||||
rsp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to do request for delete the branch: %s, err: %s, code: %s", branch, err, rsp.StatusCode))
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("Delete branch for %s successful", path))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *Gitea) RequestUpdate(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
logger.Debugf(ctx, fmt.Sprintf("RequestUpdate start, mod title: %s", path))
|
||||
|
||||
pulls, err := GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Token)
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||
return err
|
||||
}
|
||||
|
||||
prExist := false
|
||||
for _, pull := range pulls {
|
||||
if strings.Contains(pull.Title, path) && pull.Base.Ref == branch {
|
||||
logger.Info(ctx, fmt.Sprintf("don't skip %s since pr exist %s", path, pull.URL)) //todo
|
||||
tVersion := getVersions(pull.Head.Ref) //Надо взять просто из названия ветки последнюю версию
|
||||
if modules.IsNewerVersion(tVersion, mod.Version, false) {
|
||||
reqDel, err := DeleteBranch(ctx, g.URL, g.Owner, g.Repository, pull.Head.Ref, g.Token)
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("Error with create request for branch: %s, err: %s", branch, err))
|
||||
continue
|
||||
}
|
||||
rsp, err := http.DefaultClient.Do(reqDel)
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("Error with do request for branch: %s, err: %s, code: %v", branch, err, rsp.StatusCode))
|
||||
continue //думаю что если не можем удалить ветку не стоит заканчивать работу, а перейти к следующей итерации
|
||||
}
|
||||
logger.Info(ctx, fmt.Sprintf("Old pr %s successful delete", pull.Head.Ref))
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
prExist = true
|
||||
}
|
||||
}
|
||||
if !prExist {
|
||||
logger.Error(ctx, fmt.Sprintf("skip %s since pr does not exist", path))
|
||||
return ErrPRNotExist
|
||||
}
|
||||
|
||||
logger.Info(ctx, fmt.Sprintf("update %s from %s to %s", path, mod.Module.Version, mod.Version))
|
||||
|
||||
return g.RequestOpen(ctx, branch, path, mod)
|
||||
}
|
||||
|
||||
func (g *Gitea) RequestList(ctx context.Context, branch string) (map[string]string, error) {
|
||||
logger.Debugf(ctx, fmt.Sprintf("RequestList for %s", branch))
|
||||
|
||||
gPulls, err := GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var path string
|
||||
rMap := make(map[string]string)
|
||||
|
||||
for _, pull := range gPulls {
|
||||
path = strings.Split(pull.Title, " ")[1] //todo Работет только для дефолтного шаблона
|
||||
rMap[path] = pull.Title
|
||||
}
|
||||
|
||||
return rMap, nil
|
||||
}
|
||||
|
||||
func getVersions(s string) string {
|
||||
re := regexp.MustCompile("[vV][0-9]+\\.[0-9]+\\.[0-9]+")
|
||||
|
||||
version := re.FindString(s)
|
||||
|
||||
return version
|
||||
}
|
||||
|
||||
func DeleteBranch(ctx context.Context, url, owner, repo, branch, token string) (*http.Request, error) {
|
||||
var buf []byte
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, fmt.Sprintf("%s/repos/%s/%s/branches/%s?token=%s", url, owner, repo, branch, token), bytes.NewReader(buf))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
return req, err
|
||||
}
|
||||
|
||||
func GetPulls(ctx context.Context, url, owner, repo, token string) ([]*giteaPull, error) {
|
||||
var pulls []*giteaPull
|
||||
var err error
|
||||
|
||||
req, err := http.NewRequestWithContext(
|
||||
ctx,
|
||||
http.MethodGet,
|
||||
fmt.Sprintf("%s/repos/%s/%s/pulls?state=open&token=%s", url, owner, repo, token),
|
||||
nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} //вроде запроса к репозиторию
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
|
||||
rsp, err := http.DefaultClient.Do(req) // выполнение запроса
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
buf, _ := io.ReadAll(rsp.Body)
|
||||
|
||||
switch rsp.StatusCode {
|
||||
case http.StatusOK:
|
||||
if err = json.Unmarshal(buf, &pulls); err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("failed to decode response %s err: %v", buf, err))
|
||||
return nil, err
|
||||
}
|
||||
return pulls, nil
|
||||
case http.StatusNotFound:
|
||||
logger.Info(ctx, "PL is not exist for %s", repo)
|
||||
return nil, ErrPRNotExist
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown error: %s", buf)
|
||||
}
|
||||
}
|
31
internal/source/github/github.go
Normal file
31
internal/source/github/github.go
Normal file
@ -0,0 +1,31 @@
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/configcli"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/modules"
|
||||
)
|
||||
|
||||
type Github struct {
|
||||
Token string
|
||||
}
|
||||
|
||||
func NewGithub(cfg configcli.Config) *Github {
|
||||
return &Github{
|
||||
Token: cfg.Source.Token,
|
||||
}
|
||||
}
|
||||
|
||||
func (g *Github) RequestOpen(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
return nil
|
||||
}
|
||||
func (g *Github) RequestClose(ctx context.Context, branch string, path string) error {
|
||||
return nil
|
||||
}
|
||||
func (g *Github) RequestUpdate(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
return nil
|
||||
}
|
||||
func (g *Github) RequestList(ctx context.Context, branch string) (map[string]string, error) {
|
||||
return nil, nil
|
||||
}
|
31
internal/source/gitlab/gitlab.go
Normal file
31
internal/source/gitlab/gitlab.go
Normal file
@ -0,0 +1,31 @@
|
||||
package gitlab
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/configcli"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/modules"
|
||||
)
|
||||
|
||||
type Gitlab struct {
|
||||
Token string
|
||||
}
|
||||
|
||||
func NewGitlab(cfg configcli.Config) *Gitlab {
|
||||
return &Gitlab{
|
||||
Token: cfg.Source.Token,
|
||||
}
|
||||
}
|
||||
|
||||
func (g *Gitlab) RequestOpen(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
return nil
|
||||
}
|
||||
func (g *Gitlab) RequestClose(ctx context.Context, branch string, path string) error {
|
||||
return nil
|
||||
}
|
||||
func (g *Gitlab) RequestUpdate(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
return nil
|
||||
}
|
||||
func (g *Gitlab) RequestList(ctx context.Context, branch string) (map[string]string, error) {
|
||||
return nil, nil
|
||||
}
|
31
internal/source/gogs/gogs.go
Normal file
31
internal/source/gogs/gogs.go
Normal file
@ -0,0 +1,31 @@
|
||||
package gogs
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/configcli"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/modules"
|
||||
)
|
||||
|
||||
type Gogs struct {
|
||||
Token string
|
||||
}
|
||||
|
||||
func NewGogs(cfg configcli.Config) *Gogs {
|
||||
return &Gogs{
|
||||
Token: cfg.Source.Token,
|
||||
}
|
||||
}
|
||||
|
||||
func (g *Gogs) RequestOpen(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
return nil
|
||||
}
|
||||
func (g *Gogs) RequestClose(ctx context.Context, branch string, path string) error {
|
||||
return nil
|
||||
}
|
||||
func (g *Gogs) RequestUpdate(ctx context.Context, branch string, path string, mod modules.Update) error {
|
||||
return nil
|
||||
}
|
||||
func (g *Gogs) RequestList(ctx context.Context, branch string) (map[string]string, error) {
|
||||
return nil, nil
|
||||
}
|
33
internal/source/source.go
Normal file
33
internal/source/source.go
Normal file
@ -0,0 +1,33 @@
|
||||
package source
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/configcli"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/modules"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/source/gitea"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/source/github"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/source/gitlab"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/source/gogs"
|
||||
)
|
||||
|
||||
type SourceControl interface {
|
||||
RequestOpen(ctx context.Context, branch string, path string, mod modules.Update) error
|
||||
RequestClose(ctx context.Context, branch string, path string) error
|
||||
RequestUpdate(ctx context.Context, branch string, path string, mod modules.Update) error
|
||||
RequestList(ctx context.Context, branch string) (map[string]string, error)
|
||||
}
|
||||
|
||||
func NewSourceControl(cfg configcli.Config) SourceControl {
|
||||
switch cfg.Source.TypeGit {
|
||||
case "github":
|
||||
return github.NewGithub(cfg)
|
||||
case "gitlab":
|
||||
return gitlab.NewGitlab(cfg)
|
||||
case "gitea":
|
||||
return gitea.NewGitea(cfg)
|
||||
case "gogs":
|
||||
return gogs.NewGogs(cfg)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -129,7 +129,7 @@ func (s *Postgres) CommentsCreate(ctx context.Context, req *pb.CommentsCreateReq
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
||||
logger.Errorf(ctx, "AddComment: unable to rollback: %v", rollbackErr)
|
||||
logger.Error(ctx, "AddComment: unable to rollback: %v", rollbackErr)
|
||||
}
|
||||
} else {
|
||||
err = tx.Commit()
|
||||
@ -159,7 +159,7 @@ func (s *Postgres) PackagesCreate(ctx context.Context, req *pb.PackagesCreateReq
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
||||
logger.Errorf(ctx, "AddPackage: unable to rollback: %v", rollbackErr)
|
||||
logger.Error(ctx, "AddPackage: unable to rollback: %v", rollbackErr)
|
||||
}
|
||||
} else {
|
||||
err = tx.Commit()
|
||||
@ -188,7 +188,7 @@ func (s *Postgres) InsertButchModules(ctx context.Context, req []models.Module)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
||||
logger.Errorf(ctx, "AddPackage: unable to rollback: %v", rollbackErr)
|
||||
logger.Error(ctx, "AddPackage: unable to rollback: %v", rollbackErr)
|
||||
}
|
||||
} else {
|
||||
err = tx.Commit()
|
||||
|
@ -64,11 +64,11 @@ func (s *Sqlite) PackageModulesCreate(ctx context.Context, pkg *models.Package,
|
||||
}
|
||||
|
||||
func (s *Sqlite) PackageDelete(ctx context.Context, req *pb.PackageDeleteReq) error {
|
||||
return fmt.Errorf("need implement")
|
||||
return fmt.Error("need implement")
|
||||
}
|
||||
|
||||
func (s *Sqlite) PackageUpdate(ctx context.Context, req *pb.PackageUpdateReq) (*models.Package, error) {
|
||||
return nil, fmt.Errorf("need implement")
|
||||
return nil, fmt.Error("need implement")
|
||||
}
|
||||
|
||||
func (s *Sqlite) PackageLookup(ctx context.Context, req *pb.PackageLookupReq) (*models.Package, error) {
|
||||
@ -126,7 +126,7 @@ func (s *Sqlite) CommentCreate(ctx context.Context, req *pb.CommentCreateReq) (*
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if rollbackErr := tx.Rollback(); rollbackErr != nil {
|
||||
logger.Errorf(ctx, "AddComment: unable to rollback: %v", rollbackErr)
|
||||
logger.Error(ctx, "AddComment: unable to rollback: %v", rollbackErr)
|
||||
}
|
||||
} else {
|
||||
err = tx.Commit()
|
||||
|
@ -42,13 +42,13 @@ func Run(ctx context.Context, store storage.Storage, td time.Duration) {
|
||||
if err != sql.ErrNoRows {
|
||||
continue
|
||||
}
|
||||
logger.Fatalf(ctx, "failed to get packages to process: %v", err)
|
||||
logger.Fatal(ctx, "failed to get packages to process: %v", err)
|
||||
}
|
||||
wg.Add(len(packages))
|
||||
for _, pkg := range packages {
|
||||
go func(p *models.Package) {
|
||||
if err := parseModFile(ctx, store, p); err != nil {
|
||||
logger.Errorf(ctx, "failed to process package %s: %v", p.Name, err)
|
||||
logger.Error(ctx, "failed to process package %s: %v", p.Name, err)
|
||||
}
|
||||
p.LastCheck.Time = time.Now()
|
||||
wg.Done()
|
||||
@ -56,7 +56,7 @@ func Run(ctx context.Context, store storage.Storage, td time.Duration) {
|
||||
}
|
||||
wg.Wait()
|
||||
if err = store.PackagesUpdateLastCheck(ctx, packages); err != nil {
|
||||
logger.Errorf(ctx, "update packages last_check %#+v, err: %v", packages, err)
|
||||
logger.Error(ctx, "update packages last_check %#+v, err: %v", packages, err)
|
||||
}
|
||||
case <-modTicker.C:
|
||||
modules, err := store.ModulesProcess(ctx, td)
|
||||
@ -64,17 +64,17 @@ func Run(ctx context.Context, store storage.Storage, td time.Duration) {
|
||||
if err != sql.ErrNoRows {
|
||||
continue
|
||||
}
|
||||
logger.Fatalf(ctx, "failed to get modules to process: %v", err)
|
||||
logger.Fatal(ctx, "failed to get modules to process: %v", err)
|
||||
}
|
||||
if err := processModules(ctx, store, modules); err != nil {
|
||||
logger.Errorf(ctx, "failed to process modules: %v", err)
|
||||
logger.Error(ctx, "failed to process modules: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func parseModFile(ctx context.Context, store storage.Storage, pkg *models.Package) error {
|
||||
logger.Infof(ctx, "process package %v", pkg)
|
||||
logger.Info(ctx, "process package %v", pkg)
|
||||
|
||||
u, err := url.Parse(pkg.URL)
|
||||
if err != nil {
|
||||
@ -107,12 +107,12 @@ func parseModFile(ctx context.Context, store storage.Storage, pkg *models.Packag
|
||||
|
||||
ref, err := repo.Head()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get head: %v", err)
|
||||
return fmt.Error("failed to get head: %v", err)
|
||||
}
|
||||
|
||||
commit, err := repo.CommitObject(ref.Hash())
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get commit: %v", err)
|
||||
return fmt.Error("failed to get commit: %v", err)
|
||||
}
|
||||
|
||||
tree, err := commit.Tree()
|
||||
@ -156,7 +156,7 @@ func parseModFile(ctx context.Context, store storage.Storage, pkg *models.Packag
|
||||
})
|
||||
|
||||
if err = store.PackageModulesCreate(ctx, pkg, modules); err != nil {
|
||||
logger.Errorf(ctx, "failed to set create modules: %v", err)
|
||||
logger.Error(ctx, "failed to set create modules: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ func processModules(ctx context.Context, store storage.Storage, mods []*models.M
|
||||
Modules: mvsu,
|
||||
OnUpdate: func(u modules.Update) {
|
||||
if u.Err != nil {
|
||||
logger.Errorf(ctx, "%s: failed: %v", u.Module.Path, u.Err)
|
||||
logger.Error(ctx, "%s: failed: %v", u.Module.Path, u.Err)
|
||||
} else {
|
||||
mvs[u.Module.Path].Version = u.Version
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user