github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/grpc/internal/binarylog/binarylog_testutil.go (about) 1 /* 2 * 3 * Copyright 2018 gRPC authors. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 19 // This file contains exported variables/functions that are exported for testing 20 // only. 21 // 22 // An ideal way for this would be to put those in a *_test.go but in binarylog 23 // package. But this doesn't work with staticcheck with go module. Error was: 24 // "MdToMetadataProto not declared by package binarylog". This could be caused 25 // by the way staticcheck looks for files for a certain package, which doesn't 26 // support *_test.go files. 27 // 28 // Move those to binary_test.go when staticcheck is fixed. 29 30 package binarylog 31 32 var ( 33 // AllLogger is a logger that logs all headers/messages for all RPCs. It's 34 // for testing only. 35 AllLogger = NewLoggerFromConfigString("*") 36 // MdToMetadataProto converts metadata to a binary logging proto message. 37 // It's for testing only. 38 MdToMetadataProto = mdToMetadataProto 39 // AddrToProto converts an address to a binary logging proto message. It's 40 // for testing only. 41 AddrToProto = addrToProto 42 )